ci(changeset): skip validation on Changesets release PRs#436
ci(changeset): skip validation on Changesets release PRs#436mattrothenberg merged 3 commits intomainfrom
Conversation
The validate-kumo-changeset.ts script enforces 'if packages/kumo/ changed,
a new .changeset/*.md file must exist'. This rule is correct for feature
PRs but is guaranteed to fail for the Changesets release PR itself:
- The release PR modifies packages/kumo/package.json (version bump) and
packages/kumo/CHANGELOG.md (entries).
- It DELETES all .changeset/*.md files it consumed.
- It never adds new changesets.
Prior release PRs didn't trigger the failure because bot-authored PRs
require a maintainer to click 'Approve and run' before the workflow
executes. PR #428 is the first where that approval was granted, exposing
the latent false-positive.
Skip validation when the PR originates from a changeset-release/* branch
(Changesets' hardcoded branch-naming convention).
|
/bonk |
|
Looking at the code changes in The implementation is clean and well-documented:
The logic is sound: release PRs by design modify LGTM 👍 One minor thought: Consider whether |
Drop GITHUB_REF_NAME fallback. Per review: GITHUB_HEAD_REF is always set on pull_request workflow runs (the only context that reaches this code, per the isPullRequestContext() guard). GITHUB_REF_NAME in PR context resolves to refs/pull/<n>/merge-style refs that would never match the changeset-release/ prefix anyway, so the fallback wasn't a correctness backup — just noise.
|
/bonk good catch. the GITHUB_REF_NAME fallback was dead code. In pull_request workflow context GITHUB_REF_NAME resolves to refs/pull//merge which would never match changeset-release/*, so the fallback was never a correctness backup — just noise. Dropped it in 358cd29 and added a comment making the isPullRequestContext() dependency explicit. |
There was a problem hiding this comment.
The fix correctly identifies Changesets release PRs by checking for the 'changeset-release/' branch prefix, which is the reliable naming convention used by changesets/action.
Key points:
- Clean early-exit before validation logic (lines 45-61)
- Uses GITHUB_HEAD_REF which is always set in PR workflow contexts
- Good logging for CI observability
- Minimal, targeted change with no impact on regular PR validation
The logic is sound: release PRs consume (delete) changeset files rather than adding them, so the validation rule would always incorrectly fail for them. This fix ensures release PRs get a green check while maintaining strict validation for all other PRs.
|
Posted an approving review on PR #436. Summary of the review: The fix correctly identifies Changesets release PRs by checking for the
The logic is sound: release PRs by design consume (delete) changeset files rather than adding them, so the "must add a new changeset" validation would always incorrectly fail. This fix ensures release PRs pass while maintaining strict validation for all other PRs. |
commit: |
Docs PreviewCommit: |
Summary
The
ci/scripts/validate-kumo-changeset.tsscript enforces "ifpackages/kumo/changed, a new.changeset/*.mdfile must exist." Correct rule for feature PRs — but guaranteed to fail on the Changesets release PR itself, because by construction the release PR:packages/kumo/package.json(version bump) andpackages/kumo/CHANGELOG.md(entries)..changeset/*.mdfiles it consumed.Why this is only hitting us now
Prior "Version Packages" PRs didn't trigger the failure — but not because they were healthy. Bot-authored PRs require a maintainer to click "Approve and run" before the
pull_requestworkflow actually executes. That approval was never granted on prior release PRs, so the Pull Request workflow sat inaction_requiredforever and the validation never ran. PR #428 is the first release PR where the workflow was approved to run, exposing the latent false-positive.Reference — same error on an earlier release PR when its workflow was briefly approved before a force-push:
https://github.com/cloudflare/kumo/actions/runs/24518655574/job/71669853648
The fix
Five lines in
validate-kumo-changeset.ts: if the PR's head branch ischangeset-release/*(the hardcoded naming convention fromchangesets/action), log and exit early. All other PRs — feature branches, Renovate/Dependabot bumps, human contributions — continue through full validation unchanged.Alternatives considered
github-actions[bot]) — fragile if the release token ever changes.skip-changeset-validationlabel — requires a human action every release; self-healing > self-disciplining.--no-verify; the CI check is the belt-and-suspenders layer and worth keeping.Expected behavior after this lands
changeset-release/*) → logsDetected Changesets release PR (branch: changeset-release/main); skipping validation.and exits 0 → green check.After merge, re-run the latest Release workflow to regenerate PR #428:
Red X on #428 should clear on the next workflow run.
Checklist