For a rust project:
name: Update Changelog
on:
workflow_dispatch: # Manual trigger
push:
branches:
- main
paths:
- 'src/**'
- 'Cargo.toml'
- 'Cargo.lock'
permissions:
contents: write
jobs:
changelog:
name: Generate Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install git-cliff
run: cargo install git-cliff --version 2.7.0
- name: Generate Changelog
run: git cliff -o CHANGELOG.md
- name: Commit Changelog
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git diff --staged --quiet || git commit -m "ci: update CHANGELOG.md"
git push