diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml new file mode 100644 index 0000000..b15102a --- /dev/null +++ b/.github/workflows/update-changelog.yml @@ -0,0 +1,32 @@ +on: + pull_request: + types: [ opened ] + +permissions: + contents: write + +jobs: + update-changelog: + if: github.event.pull_request.user.login == 'dependabot[bot]' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Update CHANGELOG + run: | + PR_TITLE="${{ github.event.pull_request.title }}" + PR_NUMBER="${{ github.event.pull_request.number }}" + + # Format: - deps(scope): description (#PR_NUMBER) + CHANGELOG_ENTRY="- $PR_TITLE (#$PR_NUMBER)" + + # Insert entry below [Unreleased] + sed -i '/\[Unreleased\]/a\'"$CHANGELOG_ENTRY" CHANGELOG.md + + - name: Commit changes + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add CHANGELOG.md + git commit -m "docs: update CHANGELOG for PR #${{ github.event.pull_request.number }}" || echo "No changes to commit" + git push