feat: auto-update CHANGELOG.md on each release (option A) - #795
Closed
fiunchinho wants to merge 1 commit into
Closed
feat: auto-update CHANGELOG.md on each release (option A)#795fiunchinho wants to merge 1 commit into
fiunchinho wants to merge 1 commit into
Conversation
After `gh release create` succeeds, splice the same release-notes body into CHANGELOG.md and push the resulting commit back to the branch. - New sentinel comment `<!-- auto-release: insert below -->` in CHANGELOG.md marks the insertion point. Pre-conventional-commit history (everything below the marker) is preserved verbatim. - cliff.toml gains a commit_parser skip rule for the auto-generated `chore: update CHANGELOG.md` commit so it doesn't trigger spurious patch bumps or appear as noise in subsequent releases' notes. - The commit-back uses `[skip ci]` to prevent re-triggering the workflow on itself (GitHub Actions + CircleCI both honor it). - Pull-rebase before push handles the narrow race window where a human merges between job start and commit-back.
3 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the push-based auto-release workflow added in #792 to also keep
CHANGELOG.mdin sync with each release. Aftergh release createsucceeds, the workflow splices the rendered release notes intoCHANGELOG.mdand pushes the resulting commit back to the branch.This implements option A from the design discussion — direct commit-back from the workflow (not a follow-up PR).
Design
Splice, not regenerate. The existing
CHANGELOG.mdcarries ~650 lines of hand-curated pre-conventional-commit history (the## [0.1.0] - 2026-02-23section and everything below it). A fullgit-cliff --outputregenerate would destroy that, so this PR uses an insertion-marker approach instead:On each release, the workflow:
CHANGELOG.mddirectly under the marker, so newest releases land at the top — matching the existing file's ordering.chore: update CHANGELOG.md for vX.Y.Z [skip ci]and pushes.Loop protection (two layers):
[skip ci]in the commit message prevents the auto-release workflow (and CircleCI) from running on the chore commit itself.cliff.tomlcommit_parsersrule (^chore: update CHANGELOG\.md-> skip) ensures that even if the chore commit ends up inside a future--unreleasedrange, git-cliff filters it out of both the version bump computation and the rendered notes. Placed before the general^chorerule (first match wins).Race protection: The concurrency group serializes auto-release jobs against each other but not against human pushes to the branch. The commit-back step does
git pull --rebase origin "$BRANCH"beforegit pushto handle the narrow window between job start and push. If the rebase fails (genuine conflict onCHANGELOG.mditself, exotic), the step errors out — the release tag and GitHub Release are already created, so nothing is half-finished; the next release re-splices.Required branch-protection change before this works in production
The main-branch protection currently requires 1 PR review, and the
github-actions[bot]is not in any bypass list. Until that's adjusted, the commit-back step will fail atgit pushwith a 403.Two options:
github-actions[bot](or a dedicated App) to "Allow specified actors to bypass required pull requests" in the branch protection rule formain. Lowest-friction.The release itself is unaffected if the commit-back fails —
gh release createhappens before the commit-back step, and the file self-heals on the next release once the protection allows the push.Out of scope (called out for awareness)
## [Unreleased]section inCHANGELOG.md(release-please residue) is left untouched. It will become permanently stale once this lands — worth deleting separately, but not bundled here to keep the diff focused.Test plan
github-actions[bot](or App token) configured onmainfeat:/fix:lands onmain-> workflow runs -> new release tag created -> new section appears inCHANGELOG.mddirectly under the marker -> chore commit lands with[skip ci]