File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ You can update the `.github/workflows/update-documentation.yml` file with the following content to resolve the push rejection issue :
2
+
3
+ ` ` ` yaml
1
4
name: "Update Documentation"
2
5
on:
3
6
push:
4
7
branches:
5
8
- main
6
9
workflow_dispatch:
7
10
11
+ jobs:
12
+ generate:
13
+ runs-on: ubuntu-latest
14
+ environment: documentation
15
+ permissions:
16
+ contents: write
17
+ pull-requests: write
18
+ if: "github.ref == 'refs/heads/main'"
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Generate Documentation
23
+ uses: devcontainers/action@v1
24
+ with:
25
+ generate-docs: "true"
26
+ base-path-to-features: "./src"
27
+
28
+ - name: Create a PR for Documentation
29
+ id: push_image_info
30
+ env:
31
+ GITHUB_TOKEN: ${{ secrets.PAT }}
32
+ run: |
33
+ set -e
34
+ echo "Start."
35
+
36
+ # Configure git and Pull latest changes
37
+ git config --global user.email github-actions@github.com
38
+ git config --global user.name github-actions
39
+ git config pull.rebase false
40
+
41
+ git pull origin main
42
+
43
+ branch=automated-documentation-update-$GITHUB_RUN_ID
44
+ git checkout -b $branch
45
+ message='Automated documentation update'
46
+
47
+ # Add / update and commit
48
+ git add */**/README.md
49
+ git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true
50
+
51
+ # Push
52
+ if [ "$NO_UPDATES" != "true" ] ; then
53
+ git push origin "$branch"
54
+ gh api \
55
+ --method POST \
56
+ -H "Accept: application/vnd.github+json" \
57
+ /repos/${GITHUB_REPOSITORY}/pulls \
58
+ -f title="$message" \
59
+ -f body="$message" \
60
+ -f head="$branch" \
61
+ -f base='main'
62
+ fi
63
+ ` ` `
64
+
65
+ This ensures the workflow pulls the latest changes from the main branch before creating a new branch and pushing the updates.name : " Update Documentation"
66
+ on :
67
+ push :
68
+ branches :
69
+ - main
70
+ workflow_dispatch :
71
+
8
72
jobs :
9
73
generate :
10
74
runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments