Repository navigation
Commit c74e6c4
authored
ci: fail check-version when a PR edits the frozen CHANGELOG.md (#4594)
## Summary
`CHANGELOG.md` was frozen in #4578, but nothing enforces the freeze: PRs
written under the old convention still edit it. This makes the existing
required `check-version` job fail when a PR changes `CHANGELOG.md`, with
a message pointing to the PR title and the "Release note" section.
The check lives in `scripts/check-new-release-version.sh`, with
regression tests in `scripts/test-check-new-release-version.sh`. No
workflow, settings or branch-protection changes are needed, because
`check-version` is already a required check.
## How it decides
The check compares `CHANGELOG.md` between the base that `check-version`
already uses and the commit under test:
- **Pull requests:** the base is the first parent of the merge ref, the
`main` snapshot the merge result was built on. Only the PR's own changes
count, so a stale PR that never touched the changelog still passes.
- **Merge queue:** the base is the queue entry ahead, which the job
already fetches. Each PR is judged only on its own change.
The check runs before the version rules, so it applies whatever the
version does, release PRs included.
## Validation
- `shellcheck` and `shfmt -i 2 -d` are clean.
`scripts/test-check-new-release-version.sh` passes 27 cases, including
two new ones that edit `CHANGELOG.md` in a temporary repo: one as a
merge-group entry and one as a `pull_request` merge result. Both new
cases fail without this PR's script change.
- Simulated locally against current `main`:
- this branch, no changelog edit (queue-style base): **PASS**
- PR editing `CHANGELOG.md` (queue-style base): **FAIL** with the freeze
message
- PR editing `CHANGELOG.md` (`pull_request` merge ref, `HEAD^1` base):
**FAIL**
- PR without a changelog edit (`pull_request` merge ref): **PASS**
## Release note
None (CI-only).1 parent f6ca10c commit c74e6c4
2 files changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
114 | 127 | | |
0 commit comments