Update Changelog #23
Workflow file for this run
This file contains 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: "Update Changelog" | |
on: | |
release: | |
types: [published] # Trigger on release publication | |
workflow_dispatch: # Allows manual trigger of this workflow | |
permissions: | |
contents: write | |
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 to access all tags | |
ref: main # Ensure we're starting from main branch | |
- name: Install git-chglog | |
run: | | |
curl -o git-chglog -L https://github.com/git-chglog/git-chglog/releases/download/0.9.1/git-chglog_linux_amd64 | |
chmod +x git-chglog | |
- name: Remove Existing CHANGELOG.md | |
run: | | |
rm -f CHANGELOG.md # Remove the existing changelog to allow complete regeneration | |
- name: Generate New CHANGELOG.md | |
run: | | |
./git-chglog -o CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clean up git-chglog | |
run: | | |
rm git-chglog | |
- name: Check for Changes | |
id: check_changes | |
run: | | |
if git diff --quiet CHANGELOG.md; then | |
echo "No changes in CHANGELOG.md" | |
echo "::set-output name=changes::false" | |
else | |
echo "Changes detected in CHANGELOG.md" | |
echo "::set-output name=changes::true" | |
fi | |
- name: Commit and Push Changes | |
if: steps.check_changes.outputs.changes == 'true' # Only run if there are changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "Update CHANGELOG" | |
file_pattern: CHANGELOG.md | |
branch: update-changelog-${{ github.run_id }} | |
- name: Create Pull Request | |
if: steps.check_changes.outputs.changes == 'true' # Only run if there are changes | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
commit-message: "Update CHANGELOG" | |
title: "Update Changelog" | |
body: "This PR updates the entire CHANGELOG to include all releases." | |
branch: update-changelog-${{ github.run_id }} | |
base: main | |
delete-branch: true # Automatically delete branch after merge |