Add Changelog workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate Changelog | ||
| on: | ||
| push: | ||
| branches: | ||
| - main # Adjust to your default branch | ||
| tags: | ||
| - 'v*' | ||
| jobs: | ||
| changelog: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # Required to push the updated CHANGELOG.md | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: [actions/checkout](https://github.com) | ||
| with: | ||
| fetch-depth: 0 # Required to fetch all tags and history | ||
| - name: Generate Changelog | ||
| uses: [orhun/git-cliff-action](https://github.com/marketplace/actions/git-cliff-changelog-generator) | ||
| id: git-cliff | ||
| with: | ||
| config: cliff.toml | ||
| args: --verbose | ||
| env: | ||
| OUTPUT: CHANGELOG.md | ||
| GITHUB_REPO: ${{ github.repository }} | ||
| - name: Commit and push changes | ||
| run: | | ||
| git config user.name 'github-actions[bot]' | ||
| git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
| git add CHANGELOG.md | ||
| # Only commit if there are changes to avoid workflow errors | ||
| git diff --quiet && git diff --staged --quiet || (git commit -m "chore: update CHANGELOG.md [skip ci]" && git push) | ||