Skip to content

Commit 980c06c

Browse files
authored
Merge pull request #77 from amblelabs/ci/fix-changelog-token
ci: fix changelog workflow auth and push target
2 parents a3d2859 + 3d1ec6c commit 980c06c

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

.github/workflows/append_changelog.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ on:
1111
required: false
1212
default: ''
1313

14+
concurrency:
15+
group: append-changelog
16+
cancel-in-progress: false
17+
1418
jobs:
1519
append-changelog:
1620
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
pull-requests: read
1724
# only proceed if merge event or manual run
1825
if: |
1926
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
@@ -23,7 +30,8 @@ jobs:
2330
uses: actions/checkout@v4
2431
with:
2532
fetch-depth: 0
26-
token: ${{ secrets.BOT_TOKEN }}
33+
ref: master
34+
token: ${{ secrets.GITHUB_TOKEN }}
2735

2836
- name: Set up Python
2937
uses: actions/setup-python@v4
@@ -36,17 +44,19 @@ jobs:
3644
- name: Run changelog updater
3745
env:
3846
GITHUB_REPOSITORY: ${{ github.repository }}
39-
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
47+
BOT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4048
GITHUB_EVENT_PATH: ${{ github.event_path }}
4149
run: |
4250
python scripts/update_changelog.py \
4351
--pr-numbers "${{ github.event.inputs.pr_numbers }}"
4452
- name: Commit & push
45-
env:
46-
TOKEN: ${{ secrets.BOT_TOKEN }}
4753
run: |
48-
git config user.name "github-bot"
49-
git config user.email "bot@users.noreply.github.com"
54+
git config user.name "github-actions[bot]"
55+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
5056
git add CHANGELOG.md
57+
if git diff --cached --quiet; then
58+
echo "No changelog changes to commit."
59+
exit 0
60+
fi
5161
git commit -m "docs: update CHANGELOG"
52-
git push https://x-access-token:${TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref }}
62+
git push origin HEAD:master

0 commit comments

Comments
 (0)