Skip to content

Commit 428a45b

Browse files
authored
chore(ci): add changelog.yml workflow (#20)
1 parent 355cb72 commit 428a45b

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/changelog.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: update-changelog
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
contents: write
8+
jobs:
9+
changelog:
10+
name: Update CHANGELOG
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
if: |
14+
!startsWith(github.event.head_commit.message, '[Release]') &&
15+
!startsWith(github.event.head_commit.message, 'chore(changelog): update CHANGELOG.md') &&
16+
github.event.head_commit.author.name != 'github-actions[bot]'
17+
steps:
18+
- uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
- uses: jdx/mise-action@v3
22+
with:
23+
experimental: true
24+
- name: Generate CHANGELOG.md
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: git cliff --config ./cliff.toml -o ./CHANGELOG.md
28+
- name: Check for CHANGELOG changes
29+
id: changelog-changes
30+
run: |
31+
if git diff --quiet CHANGELOG.md; then
32+
echo "No changes in CHANGELOG.md"
33+
echo "has-changes=false" >> $GITHUB_OUTPUT
34+
else
35+
echo "CHANGELOG.md has changes"
36+
echo "has-changes=true" >> $GITHUB_OUTPUT
37+
fi
38+
- name: Commit CHANGELOG
39+
uses: stefanzweifel/git-auto-commit-action@v7
40+
if: steps.changelog-changes.outputs.has-changes == 'true'
41+
with:
42+
commit_message: "chore(changelog): update CHANGELOG.md"
43+
commit_options: '--no-verify'
44+
file_pattern: CHANGELOG.md
45+
commit_user_name: github-actions[bot]
46+
commit_user_email: github-actions[bot]@users.noreply.github.com

0 commit comments

Comments
 (0)