My Workflow
My submission to the Hackathon: an Action that automatically keeps the CHANGELOG.md
up-to-date with the release notes of a project.
When a new release is published, the Action takes the name and body text of the release and adds them at the right place within the CHANGELOG.md
file.
If the changelog follows the "Keep a Changelog"-format and has an "Unreleased" heading with a link to GitHub's compare view, the Action will to a bit of magic. At first, it will update the compare URL of the "Unreleased" heading to point to the new release and HEAD
.
It will then also use that URL to build another compare URL, to allow users to compare the previous release to the latest release (eg. compare v1.0.0
to v1.1.0
).
With the recent overhaul of the "Releases" feature on GitHub and the adding of the "Auto Generate Release Notes"-button, I hope this Action will help increase the adoption of changelogs and will reduce the burden to keep those changelogs up-to-date.
Submission Category:
Maintainer Must-Haves
Yaml File or Link to Code
Workflow to use this Action.
# .github/workflows/update-changelog.yaml
name: "Update Changelog"
on:
release:
types: [released]
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: main
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}
- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
stefanzweifel / changelog-updater-action
A GitHub Action to automatically update a "Keep a Changelog" CHANGELOG with the latest release notes.
changelog-updater Action
A GitHub Action to update a changelog with the latest release notes.
The Action …
- adds a new second level heading for the new release
- pastes your release notes in the appropriate place in
CHANGELOG.md
If your changelog follows the "Keep a Changelog" format and contains an "Unreleased"-heading, the Action will update the heading to point to the compare view between the latest version and HEAD
. (Read more about this here)
Don't want to use GitHub Actions? Checkout the changelog-updater CLI that powers this Action Want to learn more about this Action? Read my introduction blog post.
Note
This Action will emit warnings in your workflow logs regarding theset-output
command until 2022-12-31.
The Action has already been updated to support the new syntax and will stop emitting a warning starting 2023-01-01.
Please do not open issues regarding this issue.
Usage
The Action is…
Additional Resources / Info
Open Source projects using this Action.
Mostly my own projects, as I just released the Action. However, Spatie, a huge contributor to open source PHP packages recently added the workflow to their PHP package template; which makes me super proud ♥️
- https://github.com/spatie/package-skeleton-laravel (A very popular PHP package template)
- https://github.com/stefanzweifel/git-auto-commit-action
- https://github.com/stefanzweifel/php-changelog-updater
- https://github.com/stefanzweifel/commonmark-mark-extension
I've written a couple of posts on my blog / dev.to profile on the motivation to create this Action:
Top comments (0)