Repository navigation
Commit b34a12b
ci(pr-automation): run Check Changeset on open PRs only (#35950)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D4n2wzAmmp4Z6W5jsqtM2qx)_
Fixes #35949
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:用户无感。已经合并的拉取请求,事后被车队摘掉待合并标签时,不再冒出一个红色的变更说明检查;仍开着的拉取请求照旧每次都检查。
- 为什么做:替维护者解决误报。合并后的那次标签变动让检查拿主干上自己的合并提交作比较基点,数出零份变更说明而报红,前两天两次被当成合并坏了。
- 出错会怎样:最坏是某个开着的拉取请求漏掉一次变更说明检查;只改一行流水线条件,直接撤回本次合并即可复原。
- 要你做什么:这次改的是 CI 工作流,属人工合并档(Tier H)。需要你或 os-zhuang / hotlong 批准后合并。
## What changes
`.github/workflows/pr-automation.yml`, job `changeset-check` only: its
job-level `if:` gains a first conjunct, `github.event.pull_request.state
== 'open'`, plus a five-line comment naming the post-merge `unlabeled
pm:awaiting-merge` event, #35842 (run 44739836712, which logged `Diff
base: 9a28a48`, that PR's own merge commit) and #35857.
Why the guard is the whole fix: on a closed PR, `merge-base origin/main
HEAD` is the PR's own merge commit once main holds it, so the step
counts zero added changesets and fails. A closed PR's verdict is final
and has nothing left to gate. Open PRs (drafts included: their `state`
is `open`) keep every run they have today, on all six subscribed
actions. `pr-size` and `auto-label` already exclude label and `edited`
events and are untouched.
Premise re-measured on `origin/main` 170ca48 before the edit: the
`if:` carried only the `skip-changeset` label term and the release-PR
term, no PR-state guard.
Whole PR: 7 added, 1 deleted, net 6 lines. No changeset: `.github/**`
ships in no package, so this PR takes the `skip-changeset` label (route
2).
## Tests
No unit-tested behaviour changed (workflow config), so no ablation.
Every repo check that parses this workflow was run at d508b3a, all
exit 0:
- `node scripts/pm/check-expected-skips.mjs --self-test` (209 cases) and
`--roster`: `Check Changeset` stays rostered as a `skip-changeset`
opt-out, now "plus 2 further condition(s) the recogniser does not read".
The self-test fixture models the old `if:` text by hand; nothing
compares it with the real file, so it needed no update.
- `pnpm check:workflow-status-functions` and its `--self-test`; `node
scripts/check-empty-changeset.mjs --self-test` (167, including the
consumer pins that slice the Check Changeset job); `node
scripts/check-changeset-no-major.mjs --self-test`; `node
scripts/pr-labels.mjs --self-test`; `node
scripts/check-whole-set-label-write.mjs` and `--self-test`.
- All 36 commands `node scripts/pm/dispatch-gates.mjs --commands`
derived for this diff (including `pnpm check:pm-dispatch-gates`, fast
tier, 2249 cases): readings in the details block below.
<details><summary>Local gate readings at d508b3a (41 commands, all
exit 0; --ran: 36 derived families accounted for, 0 NOT-MEASURED, a
derived zero)</summary>
```text
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-self-test-wired.mjs :: exit 0
node scripts/check-self-test-wired.mjs --self-test :: exit 0
node scripts/check-self-test-workflow-commands.mjs :: exit 0
node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0
node scripts/check-step-collectors.mjs :: exit 0
node scripts/check-step-collectors.mjs --self-test :: exit 0
node scripts/check-whole-set-label-write.mjs :: exit 0
node scripts/check-whole-set-label-write.mjs --self-test :: exit 0
node scripts/docs-audit/check-drift-comment.mjs :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:agent-test-spelling :: exit 0
pnpm check:aggregator-roster :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:declared-population-live :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:node-version :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:pm-expected-skips :: exit 0
pnpm check:pm-governed-merges :: exit 0
pnpm check:pm-post-stamped :: exit 0
pnpm check:pm-record-recognisers :: exit 0
pnpm check:pnpm-acquisition :: exit 0
pnpm check:pnpm-filter-targets :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:required-contexts :: exit 0
pnpm check:shard-attestation :: exit 0
pnpm check:stall-guard-budget :: exit 0
pnpm check:stall-guard-headroom :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:workflow-status-functions :: exit 0
pnpm check:workflow-step-name-quoting :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --self-test :: exit 0
node scripts/pr-labels.mjs --self-test :: exit 0
node scripts/pm/check-expected-skips.mjs --self-test :: exit 0
node scripts/pm/check-expected-skips.mjs --roster :: exit 0
node scripts/check-workflow-status-functions.mjs --self-test :: exit 0
pnpm check:pm-dispatch-gates :: exit 0
```
</details>
## Acceptance notes
- `actionlint` is not installed in this container: NOT MEASURED locally.
The edited `if:` parses with the `yaml` package to the expected single
expression.
- The `merge_group` and `push` events never reach this workflow (it
subscribes to `pull_request` only), so the new term cannot skip a queue
build.
## Verification
Read first: `.github/workflows/pr-automation.yml`, the `changeset-check`
`if:` hunk (the only risk: a wrong spelling would skip the gate on open
PRs too).
Two-minute check: on any open PR without `skip-changeset`, `Check
Changeset` still runs on every event; on a PR merged after this one
lands, removing a label now leaves `Check Changeset` `skipped` instead
of `failure`. GitHub reads the workflow at the event's commit, so PRs
merged before this one (#35842, #35857, and any later post-merge label
event on them) keep the old behaviour. The first live proof is this PR's
own post-merge `unlabeled pm:awaiting-merge`.
Session: https://claude.ai/code/session_016WV4d1ZJL93Kin2UHFXbFv
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: repo:objectstack#4 · os-elon-musk ·
session_016WV4d1ZJL93Kin2UHFXbFv -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent 72b7f13 commit b34a12b
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
308 | 313 | | |
309 | | - | |
| 314 | + | |
| 315 | + | |
310 | 316 | | |
311 | 317 | | |
312 | 318 | | |
| |||
0 commit comments