Repository navigation
ci(changes): read what a pull request changed from the run's merge commit - #4447
Conversation
github.event.pull_request.base.sha is the base branch as the pull request last saw it. After the base moved, the difference from it to the run's merge commit also held the files of the pull requests merged in between, so a docs-only or browser-unreachable pull request ran every job. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Merged through Reviews: CodeRabbit reviewed this head with no open thread; no other review ran. It changes when two jobs of the required check "Integration and browser" are skipped (the changed paths are now read from the run's merge commit): merged on the maintainer's word of 2026-11-22 ("merge it"). |
What
"Detect changes" reads what a pull request changed from the run's own merge commit (
HEAD^1..HEAD) instead of fromgithub.event.pull_request.base.sha.The defect
github.event.pull_request.base.shais the base branch as the pull request last saw it, not the commit the run's merge commit was made on. Oncemainhas moved,git diff "$BASE_SHA" HEADalso lists the files of the pull requests merged in between, and the two skips that depend on the list stop applying:code=false(a docs-only pull request skips the heavy jobs), andbrowser=false(ci(browser): skip the browser jobs for a pull request whose changes cannot reach them #4441: a pull request whose paths cannot reach the Browser regression jobs skips them).Seen on #4426, which changes
ovis-site/, twoscripts/ovis-site*.test.tsfiles and a changelog fragment:scripts/ci-browser-reach.shsaysbrowser=falsefor those six paths, but run 44934012378 ran every browser job. The event's base was c4ee709 (#4444); the merge commit d36a19d was made on 5197b05 (#4445), so the difference also held #4445'sscripts/ci-browser-quarantine.tsandscripts/relay-panel-regression.ts, which keep the browser jobs. With merges tomainevery few minutes this is the common case, not a rare one.The error was always on the safe side (more jobs, never fewer).
The fix
In the filter step: when
HEADis a merge commit, the base is its first parent.actions/checkoutchecks outgithub.sha, which for apull_requestevent is the merge of the head into the base, andfetch-depth: 0is already set, so both parents are there. AHEADthat is no merge commit keeps the event's base as before.This narrows the list to exactly the pull request's own paths, which is what both skips were written for. It cannot skip a job for a path the pull request does change: those paths are in
HEAD^1..HEADby construction.Validation
scripts/release-ci-reuse.test.tsruns the filter step in a temp repository. New cases: the base moved after the pull request saw it and another pull request's client code was merged meanwhile; a unit-test-only pull request still getsbrowser=false, a docs-only onecode=false, and one that changes client code itselfcode=true,browser=true. With the new line taken out the test fails.bun run check fast: passed (22,319 unit tests, typecheck, build, workflow syntax).Merge
This changes when two of a required check's jobs are skipped: it waits for the maintainer's word.
🤖 Generated with Claude Code