Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/auto-changelog-generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Generate Changelog

on:
# Manual trigger only
workflow_dispatch:

jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Force-checkout latest commit on branch
run: |
git fetch
git reset --hard origin/${{ github.head_ref }}

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0

- name: Install github-changelog-generator
run: gem install github_changelog_generator

- name: Generate Changelog
run: |
github_changelog_generator \
-u ${{ github.repository_owner }} \
-p ${{ github.event.repository.name }} \
--token ${{ secrets.GITHUB_TOKEN }} \
--output CHANGELOG.md

- name: Commit updated CHANGELOG.md
id: commit
run: |
git add CHANGELOG.md
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if git diff --quiet && git diff --staged --quiet; then
echo "No changes in CHANGELOG.md, skipping commit."
echo "commit_status=skipped" >> $GITHUB_ENV
else
git commit -m "Update CHANGELOG.md"
echo "commit_status=committed" >> $GITHUB_ENV
fi

- name: Echo CHANGELOG.md
run: cat CHANGELOG.md

- name: Push changes
if: env.commit_status == 'committed'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}