ci: add changelog lint to catch malformed CHANGELOG.md#33117
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
|
I have actually already been working on fixing all the problems with https://github.com/MetaMask/auto-changelog from that package, but this should help a little. I put |
|
ah @HowardBraham sorry saw this now, almost merged it, will convert it to draft |
|
Converted to draft, until @HowardBraham thumbs up |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
None of these changes touch app source code, UI components, controllers, navigation, test page objects, selectors, flows, or any other code that could affect E2E test outcomes. No E2E smoke tags are warranted. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e081453. Configure here.
| rc_flag=(--rc) | ||
| else | ||
| echo "Branch '${branch}' is not release-oriented: validating without --rc" | ||
| fi |
There was a problem hiding this comment.
RC lint ignores PR base branch
Medium Severity
lint-changelog.sh only treats GITHUB_HEAD_REF (then GITHUB_REF_NAME / current git branch) as release-oriented for --rc. Pull requests that target release/* or release-changelog/* with a non-matching head branch skip --rc, so CI may not verify that package.json’s version has a changelog section on those release PRs.
Reviewed by Cursor Bugbot for commit e081453. Configure here.
|





Description
The automated main-version-bump PR for the 8.3.0 release cut never got created:
MetaMask/github-tools'screate-release-praction crashed withError: Malformed category header: '### **Before**'while regeneratingCHANGELOG.mdon therelease-changelog/8.3.0branch, because a prior PR's raw "Screenshots/Recordings" template text had been committed verbatim into the changelog instead of a clean entry. Nothing in mobile's CI validatesCHANGELOG.mdformatting today, so this kind of corruption is invisible until it silently breaks the release-cut pipeline.This adds a changelog lint, mirroring the pattern
metamask-extensionalready uses:scripts/lint-changelog.sh: a branch-aware wrapper around@metamask/auto-changelog validate(the same non-mutating parser the release pipeline'sauto-changelog updateuses internally, so it fails on the exact same malformed input). On release-oriented branches (release/X.Y.Z(-ota)?,release-changelog/X.Y.Z*) it adds--rc, which also verifies the currentpackage.jsonversion has a changelog section.lint:changelog/lint:changelog:rcscripts inpackage.json, wired into the existingscriptslint matrix in.github/workflows/ci.ymlso it runs on every PR — including changelog PRs intorelease/*and release PRs intostable— without needing a new job.CHANGELOG.mdviaauto-changelog validate --fix, which stripped 718 extraneous blank lines (verified zero content lines added/removed) so the new check starts green instead of failing immediately onmain.Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Locally verified:
yarn lint:changelogpasses onmain; re-injecting the exact### **Before**corruption that broke the 8.3.0 release cut reproduces the identicalMalformed category headererror; simulatingrelease/8.3.0/release-changelog/8.3.0branch names viaGITHUB_REF_NAME/GITHUB_HEAD_REFcorrectly switches the script into--rcmode.Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Changes are limited to CI and changelog tooling; no runtime app behavior, with the main effect being failed PRs when CHANGELOG.md is invalid.
Overview
Adds CHANGELOG.md validation to the existing CI
scriptsmatrix so every PR runsyarn lint:changelog, catching malformed changelog entries (e.g. invalid category headers) before they break release-cut automation.Introduces
scripts/lint-changelog.sh, which runs@metamask/auto-changelog validate --prettierand turns on--rconrelease/*,release/*-ota, andrelease-changelog/*branches so the currentpackage.jsonversion must have a matching changelog section.package.jsongainslint:changelog,lint:changelog:rc, and arepositoryfield so auto-changelog can resolve the repo URL under Yarn Berry.Reviewed by Cursor Bugbot for commit e081453. Bugbot is set up for automated code reviews on this repo. Configure here.