Skip to content

fix: render only the latest release's notes, not the full history - #15

Merged
fiunchinho merged 1 commit into
mainfrom
fix-latest-release-only-in-notes
Jun 3, 2026
Merged

fix: render only the latest release's notes, not the full history#15
fiunchinho merged 1 commit into
mainfrom
fix-latest-release-only-in-notes

Conversation

@fiunchinho

Copy link
Copy Markdown
Member

Summary

Regression I introduced in #13. v1.4.1 and v1.4.2 release bodies contain every release since repo inception, concatenated. v1.4.0 (created before #13 landed) is clean.

What I broke

The old workflow's render step was:

git-cliff --latest --strip all --output release-notes.md

When I consolidated cliff invocations in #13, I kept --strip all (the whitespace handling) but lost `--latest` (the latest-release filter). The new flow:

git-cliff --bump --context > cliff-context.json        # context for ALL releases ever
git-cliff --from-context cliff-context.json --strip all --output release-notes.md   # renders ALL releases

The render step happily produced the entire changelog history each time.

Why my local verification didn't catch it

When I tested the consolidation locally I rendered against a fresh clone with only ~3 tags — the output looked plausible at a glance and I didn't realize `--latest` was missing until v1.4.2's release page showed years of history in one body. Lesson: a fresh repo with few tags is a poor reproducer for "did I lose the filter."

Fix

One word: add `--latest` to the context-generation step.

- git-cliff --bump --context > cliff-context.json
+ git-cliff --bump --latest --context > cliff-context.json

Tried adding `--latest` to the `--from-context` step instead — silently ignored. Filtering has to happen at context generation time, not render time.

Verified locally

$ git-cliff --latest --bump --context | jq 'length'
1
$ git-cliff --from-context cliff-context.json --strip all
### Fixed

- Create tag and release atomically via gh release create in [#14](...) by [@fiunchinho](...)

**Full Changelog**: ...compare/v1.4.1...v1.4.2

Only the bumped release. No history concatenation.

Cosmetic cleanup of already-broken releases (optional)

v1.4.1 and v1.4.2 release pages will continue to show the bloated bodies until manually corrected with gh release edit v1.X.Y --notes-file <correct-notes>. Doable but optional — the releases themselves are valid (tags, assets, etc. are all fine); only the page text is wrong.

Happy to do that cleanup as a follow-up if you want it tidied.

Test plan

  • Local: confirmed --latest --bump --context produces single-release JSON.
  • After squash-merge: v1.4.3 release (this is fix: so patch bump) has notes body containing ONLY this PR's bullet + the Full Changelog footer for v1.4.2 → v1.4.3. No older releases appear.

Regression introduced in #13 (the consolidate-git-cliff-calls change).
The old workflow used `--latest --strip all` on the render step, where
`--latest` filtered the output to just the bumped release. When I
consolidated to `--bump --context` + `--from-context`, I kept
`--strip all` (whitespace handling) but dropped `--latest`, with the
result that the context JSON contained EVERY release since repo
inception and the render concatenated all of them into each new
release's notes body.

Symptom: v1.4.1 and v1.4.2 release pages have notes that include
v1.4.0, v1.3.2, v1.3.1, … all the way back to v1.0.0. v1.4.0 (created
before #13 landed) is clean.

Fix is a one-word addition: pass `--latest` alongside `--bump --context`
so the JSON only contains the bumped release. Render then has nothing
else to render. No need for --latest on the --from-context call (which
turns out to be ignored anyway — filtering has to happen at context
generation time).

Local verification: `git-cliff --latest --bump --context | jq 'length'`
returns 1 (one release in the JSON); rendering that JSON produces a body
with just the latest release's bullets + footer.

Cleanup of the already-broken v1.4.1 and v1.4.2 release bodies is a
separate, optional follow-up (gh release edit --notes-file).
@fiunchinho fiunchinho self-assigned this Jun 3, 2026
@fiunchinho
fiunchinho merged commit 265bfe3 into main Jun 3, 2026
1 check passed
@fiunchinho
fiunchinho deleted the fix-latest-release-only-in-notes branch June 3, 2026 13:49
fiunchinho added a commit that referenced this pull request Jun 3, 2026
…y bumps (#16)

PR #15's "fix" for the full-history regression was wrong. I added
`--latest` thinking it would filter the cliff context to just the bumped
release; what it actually does in combination with `--bump` is return
the latest EXISTING tag and silently drop the bump. Result: PR #15's
merge ran the workflow successfully but computed `next: v1.4.2` (the
existing tag), said "no releasable commits", and skipped tagging. We
never got the v1.4.3 release that should have validated #15 itself.

The right flag is `--unreleased --bump --context`:
  --unreleased : filter to commits not yet in any tag
  --bump       : compute the bumped version from those commits
  --context    : output as JSON

Together they produce a single-release JSON for just the bumped
version. Verified locally on a fresh clone at the PR #15 merge commit:
returns `v1.4.3` (correct), one element in the JSON, renders cleanly
with just the new release's bullets + Full Changelog footer.

Acknowledging: this is the second swing at the same regression
(originally introduced in #13, mis-fixed in #15). Lesson: end-to-end
local testing on a fresh clone with the real tag history would have
caught both issues immediately.
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