Skip to content

Commit 4704adf

Browse files
committed
Automatically update changelog
1 parent 3491fd5 commit 4704adf

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.github/workflows/check-changelog.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# CHANGELOG.md is generated by https://github.com/github-changelog-generator/github-changelog-generator
22
# This job verifies, that it contains always the current content
3+
# and also pushes the updated changelog to https://github.com/pmd/pmd-github-action/blob/main/CHANGELOG.md
34
name: Check Changelog
45

56
on:
@@ -30,13 +31,22 @@ jobs:
3031
if [ "$(git diff CHANGELOG.md | wc -l)" -gt "0" ]; then
3132
echo "Detected uncommitted changes after build. See status below:"
3233
git diff
33-
exit 1
34+
echo "changelog=outdated" >> $GITHUB_ENV
35+
else
36+
echo "changelog=current" >> $GITHUB_ENV
3437
fi
3538
id: diff
3639

3740
# If CHANGELOG.md was different than expected, upload the expected version as an artifact
3841
- uses: actions/upload-artifact@v2
39-
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
42+
if: ${{ env.changelog == 'outdated' }}
4043
with:
4144
name: changelog
4245
path: CHANGELOG.md
46+
47+
- name: Push changes to CHANGELOG.md
48+
if: ${{ github.repository == 'pmd/pmd-github-action' && env.changelog == 'outdated' }}
49+
run: |
50+
git config --local user.email "<>"
51+
git config --local user.name "GitHub Actions Bot"
52+
git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md' && git push origin main

.github_changelog_generator

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
user=pmd
22
project=pmd-github-action
33
include-tags-regex=v\d{1,}\.\d{1,}\.\d{1,}
4+
add-sections={"dependencies":{"prefix":"**Dependency updates:**","labels":["dependencies"]}}
5+
usernames-as-github-logins=true

0 commit comments

Comments
 (0)