fix(version): attribute changelog entries per package, not per squash commit#94
Draft
exo-mv wants to merge 1 commit into
Draft
fix(version): attribute changelog entries per package, not per squash commit#94exo-mv wants to merge 1 commit into
exo-mv wants to merge 1 commit into
Conversation
15be46d to
e297d48
Compare
… commit A squash-merged PR collapses its commits into one, so conventional-changelog — which keys a commit to a package by the files it touched — rendered the whole squash message (breaking-change footers and Co-Authored-By trailers included) into the changelog of every package the PR touched. This leaked one package's BREAKING CHANGE into unrelated packages' changelogs and dumped the squashed body verbatim. Re-attribute each squash commit to its package with an `options.transform` hook on conventional-changelog-core: decompose the commit back into the PR's pre-squash commits (fetched from the API), keep only those whose files map to the package being released, and re-parse each on its own so unrelated bodies never bleed in. Each emitted entry is stamped with the squash commit's hash and a `(#PR)` reference so links still resolve to the merged commit and PR. Route every path through this generator. The explicit-`bumps` and static paths already let this action write changelogs; the conventional-commits path now runs `lerna version --no-changelog` (lerna still derives the per-package bumps) so it does too, instead of leaving the leak in lerna's own changelog generation. The PR-commits fetch is extracted to utils/pr-commits and shared with version-dispatch, so changelog attribution and bump attribution agree on which commit touched which package. Non-squash commits fall back to conventional-changelog's previous behavior unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude <noreply@anthropic.com>
e297d48 to
40cbfe7
Compare
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
Co-Authored-Bytrailers, sub-commit bullets) into every touched package's changelog. Each squash commit is decomposed back into its pre-squash commits (fetched from the PR) and re-attributed by file path, so aBREAKING CHANGElands only in the changelog of the package whose files the breaking commit actually touched.options.transformhook on conventional-changelog-core, so tag detection, range, version header, links, and grouping are unchanged.bumpsand static-strategy paths already let this action write changelogs; theconventional-commitspath now runslerna version --no-changelog(lerna still derives the per-package bumps) and routes through the same generator, instead of leaving the leak in lerna's own changelog code.utils/pr-commitsand shared withversion-dispatch, so changelog and bump attribution agree. Non-squash commits fall back to prior behavior.Out of scope
On the
conventional-commitspath, lerna still decides the version bump per package, and it over-attributes a breaking squash commit to every package the commit touched (the motivation for the per-packagebumpsflow in #82). This PR fixes the changelog there but not the bump — a multi-package conventional release can still mis-bump a consumer. Correct multi-package bumps come from the explicit/version-dispatch flow.Test plan
changelog-transform.spec.ts,update-changelog.spec.ts): the cross-package leak is gone; the legacy path still reproduces it.actions-playground, both paths — one squash touching batcave (breaking) + gadgets (consumer):bumps: gadgets@1.0.1 changelog has only its own fix; batcave@5.0.0 keeps the breaking note.conventional-commits: gadgets changelog has noBREAKING CHANGESsection (leak gone); batcave keeps both breaking notes. (lerna did mis-bump gadgets to major here — the out-of-scope item above.)🤖 Generated with Claude Code