Skip to content

Commit 1e95f8d

Browse files
committed
ci: push changelog via deploy key, drop BOT_TOKEN dependency
PATs (fine- or coarse-grained) issued to bypass-team members were the only way for the workflow to push past the PRS-ONLY ruleset, and that came back to bite us when BOT_TOKEN expired. The ruleset already allows any deploy key with bypass_mode:always, so swap to that path: - actions/checkout uses ssh-key: CHANGELOG_DEPLOY_KEY, which auths the clone over SSH and configures origin for SSH push - the script reads PR metadata via secrets.GITHUB_TOKEN (the token has full read for pull_request_target and workflow_dispatch) - lock GITHUB_TOKEN to contents:read + pull-requests:read since we no longer need write - drop the https x-access-token push in favour of ssh-driven git push origin HEAD:master
1 parent 53b6392 commit 1e95f8d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/append_changelog.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ concurrency:
1818
jobs:
1919
append-changelog:
2020
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
2124
# only proceed if merge event or manual run
2225
if: |
2326
(github.event_name == 'pull_request_target' && github.event.pull_request.merged == true) ||
@@ -28,7 +31,7 @@ jobs:
2831
with:
2932
fetch-depth: 0
3033
ref: master
31-
token: ${{ secrets.BOT_TOKEN }}
34+
ssh-key: ${{ secrets.CHANGELOG_DEPLOY_KEY }}
3235

3336
- name: Set up Python
3437
uses: actions/setup-python@v4
@@ -41,14 +44,12 @@ jobs:
4144
- name: Run changelog updater
4245
env:
4346
GITHUB_REPOSITORY: ${{ github.repository }}
44-
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
47+
BOT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4548
GITHUB_EVENT_PATH: ${{ github.event_path }}
4649
run: |
4750
python scripts/update_changelog.py \
4851
--pr-numbers "${{ github.event.inputs.pr_numbers }}"
4952
- name: Commit & push
50-
env:
51-
TOKEN: ${{ secrets.BOT_TOKEN }}
5253
run: |
5354
git config user.name "github-bot"
5455
git config user.email "bot@users.noreply.github.com"
@@ -58,4 +59,4 @@ jobs:
5859
exit 0
5960
fi
6061
git commit -m "docs: update CHANGELOG"
61-
git push https://x-access-token:${TOKEN}@github.com/${{ github.repository }} HEAD:master
62+
git push origin HEAD:master

0 commit comments

Comments
 (0)