Skip to content

feat(release/auto-changelog): preserve finalized changelog history when merging previous releases - #300

Open
HowardBraham wants to merge 1 commit into
mainfrom
merge-previous-releases
Open

HowardBraham wants to merge 1 commit into
mainfrom
merge-previous-releases

Conversation

@HowardBraham

@HowardBraham HowardBraham commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

References

  • This is part of the release-changelog automation, splitting it into smaller reviewable PRs.

Explanation

Current state

When a new release/X.Y.Z branch is created, merge-previous-releases.sh merges every older active release branch into it with git merge -s ours. That records the ancestry without duplicating code, but it also keeps the destination's files. If an older release has already published its finalized changelog section (## [13.54.0] plus its [13.54.0]: … link), the new branch never gets it, and the next release's changelog is generated without it.

Solution

After each -s ours merge, the script now runs a new merge-previous-release-changelog.mts. It does the following:

  • It copies the older release's ## [version] section and its link reference from the source CHANGELOG.md into the destination, in newest-first order.
  • It then amends the merge commit to include the change.
  • It edits the changelog as plain text, not through a parser, and it leaves the destination untouched, with a warning, when it isn't sure. That covers a missing or duplicated source section, a destination that already has the release, and any error.

The script is TypeScript that Node runs directly with no build step. Native .mts support needs Node 22.18 or later, so this PR also moves the repo from Node 20 to 22:

  • .nvmrc goes from v20 to v22.23.4.
  • engines.node and the constraints.pro rule go from >=20.0.0 to >=22.18.0.
  • The merge action gains a setup-node step that reads .nvmrc. Before this it ran on whatever Node the runner had.

Impact of the Node bump

.nvmrc feeds seven actions through node-version-file (check-changelog, draft-segment-schema-pr, flaky-test-report, playwright-test-health-report, post-merge-validation, publish-slack-release-testing-status and the merge action), plus the post-relay-subsidy-balance workflow. Their consumers move from Node 20 to 22. Actions with their own pinned Node (stable-sync, remove-rca-needed-label-sheets, setup-e2e-env) aren't affected. Reviewers should confirm that moving those actions to Node 22 is acceptable.

Other changes

  • Tests: merge-previous-releases.test.mts runs the real shell script against a throwaway origin and clone, with a fake gh. It covers a preserved release, an ambiguous source, and a destination that already has the release.
  • yarn test: it now runs every *.test.{mjs,mts} file with one node --test. This also picks up playwright-test-health-report/lib/report-health.test.mjs, which was never wired into yarn test.
  • Tooling: no new scripts or configs. The .mts files are added to the existing tsc (via include) and lint:eslint runs, plus two small ESLint overrides. lint:eslint stays two commands, because ESLint ignores dot-directories.

Testing

  • Local: tsc, lint:eslint and node --test pass on Windows and on Linux (Ubuntu with Node 22.23.4, no git identity configured).
  • Fork, with the action pinned to a SHA: on consensys-test/metamask-extension-howard, a new release/ branch merged an older active release. setup-node installed 22.23.4 and the log showed Inserted finalized 999.999.999 changelog history. The section was byte-identical to the source, sat in version order, and only CHANGELOG.md changed. A branch whose destination already had the section was left byte for byte. Runs: 40046194251, 40046722723, 40059428200.
  • Not tested: I only exercised the merge action. The other six actions haven't run on Node 22 in a fork. The Node 22 move relies on tsc, ESLint, the constraints check and the unit tests passing, not on those actions running.

Note

Medium Risk
Touches release-branch merge automation and mutates CHANGELOG.md on the new RC; behavior is conservative on errors, but the Node 20→22 bump affects every action/workflow that reads this repo’s .nvmrc.

Overview
After each git merge -s ours when folding older active release branches into a new release/* branch, changelog history is no longer dropped: a new merge-previous-release-changelog.mts copies the source’s finalized ## [version] block and link reference into CHANGELOG.md in version order, then the shell script amends the merge commit when that file changes. Ambiguous or unsafe cases warn and leave the destination unchanged so release merges don’t fail on changelog edits.

The repo requires Node ≥22.18 (.nvmrc, engines, constraints) so CI can run the .mts script without a build step; the merge-previous-releases composite action adds setup-node from github-tools/.nvmrc. Tooling picks up the new scripts via tsconfig/eslint overrides, yarn test runs all .github/**/*.test.{mjs,mts}, and integration tests exercise the real merge shell script with git fixtures.

Reviewed by Cursor Bugbot for commit 884e1f4. Bugbot is set up for automated code reviews on this repo. Configure here.

@HowardBraham HowardBraham self-assigned this Oct 24, 2026
@HowardBraham
HowardBraham force-pushed the merge-previous-releases branch from ac9c6d1 to 884e1f4 Compare October 24, 2026 03:54
@HowardBraham HowardBraham changed the title feat(release): preserve finalized changelog history when merging previous releases feat(release/auto-changelog): preserve finalized changelog history when merging previous releases Oct 24, 2026
@HowardBraham
HowardBraham marked this pull request as ready for review October 24, 2026 03:59

This branch has not been deployed

No deployments
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