Skip to content

Update Changelog

Update Changelog #25

name: "Update Changelog"
on:
release:
types: [published] # Trigger on release publication
workflow_dispatch: # Allows manual trigger
permissions:
contents: write # Minimum required permission for file changes and PR creation
pull-requests: write # Required for creating PRs
jobs:
update-changelog:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for changelog generation
ref: main # Start from main branch
- name: Setup git-chglog
run: |
CHGLOG_VERSION="0.9.1"
curl -o git-chglog -L "https://github.com/git-chglog/git-chglog/releases/download/${CHGLOG_VERSION}/git-chglog_linux_amd64"
chmod +x git-chglog
- name: Generate CHANGELOG.md
id: generate
run: |
rm -f CHANGELOG.md # Remove existing changelog
./git-chglog -o CHANGELOG.md
# Check for changes and set output
if git diff --quiet CHANGELOG.md; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup
run: rm git-chglog
if: always() # Ensure cleanup happens even if previous steps fail
- name: Create Pull Request
if: steps.generate.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update CHANGELOG.md"
title: "📝 Update Changelog"
body: |
This PR updates the CHANGELOG.md to include all releases.
- Generated using git-chglog
- Triggered by: ${{ github.event_name }}
branch: update-changelog-${{ github.run_id }}
base: main
delete-branch: true
labels: |
documentation
automated-pr