Skip to content

Commit 37c2cb7

Browse files
committed
fix(ci): use appropriate tokens for pages pushes and fix update workflow
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent 6b9accd commit 37c2cb7

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

.github/workflows/generate-top-index.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3131
with:
3232
fetch-depth: 0
33+
token: ${{ secrets.COMMAND_BOT_PAT }}
3334

3435
- name: Get stable branches
3536
id: branch
@@ -57,8 +58,8 @@ jobs:
5758
run: |
5859
git fetch origin gh-pages
5960
git checkout gh-pages
60-
git config --local user.email "action@github.com"
61-
git config --local user.name "GitHub Action"
61+
git config --local user.email "nextcloud-command@users.noreply.github.com"
62+
git config --local user.name "nextcloud-command"
6263
6364
- name: Commit and push changes
6465
if: github.event_name == 'push'
@@ -70,3 +71,5 @@ jobs:
7071
git add index.html static/
7172
git commit -m "chore: update index.html for documentation" || echo "No changes to commit"
7273
git push origin gh-pages || echo "Nothing to push (expected if no changes)"
74+
env:
75+
GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}

.github/workflows/sphinxbuild.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ jobs:
138138
with:
139139
ref: gh-pages
140140
fetch-depth: 0
141+
token: ${{ secrets.COMMAND_BOT_PAT }}
141142

142143
- name: Download all ${{ needs.build.outputs.branch_name }} artifacts
143144
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -225,13 +226,15 @@ jobs:
225226
226227
- name: Commit ${{ steps.branch.outputs.branch_name }} documentation and push to gh-pages
227228
run: |
228-
git config --local user.email "action@github.com"
229-
git config --local user.name "GitHub Action"
229+
git config --local user.email "nextcloud-command@users.noreply.github.com"
230+
git config --local user.name "nextcloud-command"
230231
git add .
231232
git diff --staged --quiet || git commit -m "chore: deploy documentation for ${{ steps.branch.outputs.branch_name }}"
232233
# Ensure we are up to date with the remote gh-pages branch
233234
git pull --rebase origin gh-pages || true
234235
git push origin gh-pages || echo "Nothing to push (expected if no changes)"
236+
env:
237+
GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
235238

236239
summary:
237240
needs: build

.github/workflows/update-workflow.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
target_branch:
20-
- stable19
2120
- stable20
2221
- stable21
2322
- stable22
@@ -38,13 +37,13 @@ jobs:
3837
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3938
with:
4039
fetch-depth: 0 # Fetch full history to access all branches
41-
token: ${{ secrets.WORKFLOW_TOKEN }}
40+
token: ${{ secrets.COMMAND_BOT_PAT }}
4241
ref: ${{ matrix.target_branch }}
4342

4443
- name: Configure Git
4544
run: |
46-
git config --local user.email "action@github.com"
47-
git config --local user.name "GitHub Action"
45+
git config --local user.email "nextcloud-command@users.noreply.github.com"
46+
git config --local user.name "nextcloud-command"
4847
4948
- name: Checkout file from master
5049
run: |
@@ -69,4 +68,12 @@ jobs:
6968
git add ${{ inputs.file_path }}
7069
git diff --cached --quiet || git commit -sm "chore: update ${{ inputs.file_path }} from master branch"
7170
72-
git push origin ${{ matrix.target_branch }}
71+
# Create a new branch for the PR
72+
pr_branch="workflow/update-${{ inputs.file_path |replace('/', '-') }}-${{ matrix.target_branch }}"
73+
git checkout -b "$pr_branch"
74+
git push origin "$pr_branch"
75+
76+
# Create a pull request
77+
gh pr create --base ${{ matrix.target_branch }} --head "$pr_branch" --title "chore: update ${{ inputs.file_path }} from master branch" --body "Automated update of ${{ inputs.file_path }} from master branch"
78+
env:
79+
GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}

0 commit comments

Comments
 (0)