Skip to content

fix: regenerate changelog after tagging in release#54

Merged
satyaborg merged 1 commit into
mainfrom
fix/release-changelog-ordering
Jun 9, 2026
Merged

fix: regenerate changelog after tagging in release#54
satyaborg merged 1 commit into
mainfrom
fix/release-changelog-ordering

Conversation

@satyaborg

Copy link
Copy Markdown
Owner

Problem

Every release since 0.3.0 wiped CHANGELOG.md down to a single empty version header (e.g. just ## [0.4.0]), dropping all prior history. The changelog was never additive.

Root cause

scripts/release.sh invoked git-cliff with two flags that, in git-cliff 2.x, each collapse the output to a bare ## [Unreleased]/## [X.Y.Z] header with no body and no prior versions:

  1. --workdir "$ROOT" (absolute path) — breaks git-cliff's detection that HEAD is on a tag. Isolated via an A/B in an identical repo state: --workdir <abs> → 1 section; no --workdir (run from cwd) → all 4 sections.
  2. --tag <new version> on an untagged HEAD — git-cliff ran before the release commit and tag existed, so it treated the version as brand new and truncated the same way.

Both were verified by reproducing the exact release-time git state in throwaway worktrees/clones and inspecting git-cliff --context (collected v0.4.0 -> 0 commits, no prior releases).

Fix

Reorder and de-flag the generation step:

  • Commit VERSION, then create the tag, so HEAD is tagged before git-cliff runs.
  • Run git-cliff from $ROOT (subshell cd) without --workdir and without --tag, so it renders the full history from the tagged commits.
  • Fold the regenerated CHANGELOG.md into the release commit via --amend and move the tag onto the amended commit, keeping one clean chore: release X commit.

Dry-run output updated to describe the new ordering.

Verification

  • bash scripts/devloop_test.sh passes (100% function coverage).
  • End-to-end in a throwaway clone: two consecutive release patch runs keep the changelog fully additive (all four versions, 119 lines), and each tag's commit contains the complete changelog.

Not retroactively backfilling the wiped CHANGELOG.md — the next patch release regenerates the full history from scratch, which is the intended behavior.

git-cliff was run on an untagged HEAD before the release commit and tag
existed, so it overwrote CHANGELOG.md with a single empty version header and
dropped all prior releases. Create the release commit and tag first, then
regenerate the changelog from the tagged history, fold it into the release
commit via --amend, and move the tag onto the amended commit.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
devloop 92f9b1e Commit Preview URL

Branch Preview URL
Jun 09 2026, 08:26 AM

@satyaborg satyaborg merged commit 49d6b5a into main Jun 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant