-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
ci: add changelog lint to catch malformed CHANGELOG.md #33117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
e0c71a2
4a0377a
5faf22d
807fc82
6fbb41f
12fe393
e081453
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -264,6 +264,7 @@ jobs: | |
| scripts: | ||
| - lint | ||
| - lint:tsc | ||
| - lint:changelog | ||
| - format:check | ||
| - audit:ci | ||
| - test:depcheck | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Validates CHANGELOG.md with @metamask/auto-changelog, mirroring the pattern used | ||
| # by metamask-extension (see .github/workflows/repository-health-checks.yml there). | ||
| # | ||
| # On release-oriented branches, `--rc` is added so validation also enforces that the | ||
| # branch's current package.json version has a corresponding changelog section. This | ||
| # is what should have caught the malformed '### **Before**' header that broke the | ||
| # 8.3.0 -> 8.4.0 release-cut automation before it ever reached CI. | ||
| # | ||
| # Branch shapes treated as release-oriented: | ||
| # release/X.Y.Z, release/X.Y.Z-ota (release branches, incl. OTA hotfixes) | ||
| # release-changelog/X.Y.Z[...] (the changelog-generation working branch) | ||
| # | ||
| # package.json has no "repository" field, so --repo is passed explicitly. | ||
| # | ||
| # --prettier tells the validator to expect the changelog in Prettier-formatted | ||
| # Markdown (blank line after headings), which matches this repo's existing | ||
| # CHANGELOG.md style. Without it, validation would fail against a stricter, | ||
| # denser canonical form (no blank line after headings) hardcoded in | ||
| # @metamask/auto-changelog's stringifier, which would otherwise force | ||
| # reformatting the entire file's history to pass. | ||
|
|
||
| readonly REPO_URL='https://github.com/MetaMask/metamask-mobile' | ||
|
tommasini marked this conversation as resolved.
Outdated
|
||
|
|
||
| branch="${GITHUB_HEAD_REF:-}" | ||
| if [[ -z "$branch" ]]; then | ||
| branch="${GITHUB_REF_NAME:-}" | ||
| fi | ||
| if [[ -z "$branch" ]]; then | ||
| branch="$(git branch --show-current 2>/dev/null || true)" | ||
| fi | ||
|
|
||
| rc_flag=() | ||
| if [[ "$branch" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+(-ota)?$ ]] || [[ "$branch" =~ ^release-changelog/[0-9]+\.[0-9]+\.[0-9]+ ]]; then | ||
| echo "Branch '${branch}' is release-oriented: validating with --rc" | ||
| rc_flag=(--rc) | ||
| else | ||
| echo "Branch '${branch}' is not release-oriented: validating without --rc" | ||
| fi | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RC lint ignores PR base branchMedium Severity
Reviewed by Cursor Bugbot for commit e081453. Configure here. |
||
|
|
||
| yarn auto-changelog validate --repo "$REPO_URL" --prettier "${rc_flag[@]+"${rc_flag[@]}"}" | ||


Uh oh!
There was an error while loading. Please reload this page.