Skip to content

Commit 84b3694

Browse files
popstasclaude
andcommitted
ci: auto-update CHANGELOG.md on release via git-cliff
After creating the GitHub release, regenerate the full CHANGELOG.md with git-cliff and commit it back to master (chore(release): ... [skip ci]), only when it actually changed. The release job now checks out master so the commit can be pushed to the branch. Keeps the tracked changelog in sync with each tagged release instead of drifting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d11f587 commit 84b3694

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- name: Check out the codebase
1919
uses: actions/checkout@v5
2020
with:
21+
ref: master # commit the regenerated CHANGELOG back to master
2122
fetch-depth: 0 # git-cliff needs full history
2223

2324
- name: Generate release notes
@@ -36,6 +37,26 @@ jobs:
3637
env:
3738
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3839

40+
- name: Regenerate CHANGELOG.md
41+
uses: orhun/git-cliff-action@v4
42+
with:
43+
config: cliff.toml
44+
env:
45+
OUTPUT: CHANGELOG.md
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Commit CHANGELOG.md to master
49+
run: |
50+
if git diff --quiet -- CHANGELOG.md; then
51+
echo "CHANGELOG.md already up to date"
52+
exit 0
53+
fi
54+
git config user.name "github-actions[bot]"
55+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
56+
git add CHANGELOG.md
57+
git commit -m "chore(release): update CHANGELOG for ${{ github.ref_name }} [skip ci]"
58+
git push origin HEAD:master
59+
3960
galaxy:
4061
name: Import to Ansible Galaxy
4162
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)