Skip to content

ci(changes): read what a pull request changed from the run's merge commit - #4447

Merged
devswha merged 1 commit into
mainfrom
ci/changed-paths-from-the-merge-commit
Nov 21, 2026
Merged

devswha merged 1 commit into
mainfrom
ci/changed-paths-from-the-merge-commit

Conversation

@devswha

@devswha devswha commented Nov 21, 2026

Copy link
Copy Markdown
Owner

What

"Detect changes" reads what a pull request changed from the run's own merge commit (HEAD^1..HEAD) instead of from github.event.pull_request.base.sha.

The defect

github.event.pull_request.base.sha is the base branch as the pull request last saw it, not the commit the run's merge commit was made on. Once main has moved, git diff "$BASE_SHA" HEAD also lists the files of the pull requests merged in between, and the two skips that depend on the list stop applying:

Seen on #4426, which changes ovis-site/, two scripts/ovis-site*.test.ts files and a changelog fragment: scripts/ci-browser-reach.sh says browser=false for 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's scripts/ci-browser-quarantine.ts and scripts/relay-panel-regression.ts, which keep the browser jobs. With merges to main every 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 HEAD is a merge commit, the base is its first parent. actions/checkout checks out github.sha, which for a pull_request event is the merge of the head into the base, and fetch-depth: 0 is already set, so both parents are there. A HEAD that 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..HEAD by construction.

Validation

  • scripts/release-ci-reuse.test.ts runs 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 gets browser=false, a docs-only one code=false, and one that changes client code itself code=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).
  • Not shown yet: a real run. feat(site): show the release the download buttons give, with a What's new link #4426, brought up to date after this merges, is the check (its browser jobs should be skipped and "Integration and browser" should still report success).

Merge

This changes when two of a required check's jobs are skipped: it waits for the maintainer's word.

🤖 Generated with Claude Code

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]>
@devswha devswha changed the title ci: read what a pull request changed from the run's merge commit ci(changes): read what a pull request changed from the run's merge commit Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Maintenance
    • CI now identifies changes from the pull request’s merge point, keeping check selection accurate when the base branch advances. This helps ensure documentation-only updates and changes limited to tests or client code receive the appropriate checks.

CI now uses the merge commit’s first parent as the diff base when the run’s HEAD has a second parent. A test covers changed-path filtering when the base branch advances after the pull request records its base.

Changes: CI changed-path detection

Layer / File(s) Summary
Select and verify the merge-commit diff base
.github/workflows/ci.yml, scripts/release-ci-reuse.test.ts, changelog.d/ci-changed-paths-from-the-merge-commit.md
When HEAD has a second parent, the workflow sets BASE_SHA to HEAD^1 before calculating changed paths. The test checks filtering for pull requests merged after intervening base-branch changes. The changelog describes the change and its stated effect on docs-only and browser-job skips.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • devswha/ovis#4441: Updates browser-job skipping based on the browser result from the same changed-path filter.
Merge Risk: Minimal · up to 36d97

CI change detection now diffs against the merge commit's first parent, so docs-only and browser-unreachable pull requests skip jobs as intended even when the base branch has advanced. Non-merge runs keep the previous behavior. The change is low risk and ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description check Passed The description follows the template. It has a Change section that describes the defect, the resulting behavior, and the fix. It has a Validation section that lists the unit tests, the bun run check f…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title names the primary change: CI change detection now reads changed paths from the run's merge commit. The changeset matches this in the workflow, changelog, and tests. The title follows the con…
Full details: Description check

Explanation

The description follows the template. It has a Change section that describes the defect, the resulting behavior, and the fix. It has a Validation section that lists the unit tests, the bun run check fast results (22,319 unit tests, typecheck, build, workflow syntax), and the pending real-run check against #4426. It does not link an issue, and the template does not require one for a fix. It does not mention the changelog fragment (changelog.d/), which the template's comment points to, and it does not state whether contract tests apply, since the change is CI-only and not HTTP/WS.

Full details: Title check

Explanation

The title names the primary change: CI change detection now reads changed paths from the run's merge commit. The changeset matches this in the workflow, changelog, and tests. The title follows the conventional commit style and is 73 characters long.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5197b05 and 36d970e.

Files selected for processing: 3

  • .github/workflows/ci.yml
  • changelog.d/ci-changed-paths-from-the-merge-commit.md
  • scripts/release-ci-reuse.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@devswha
devswha merged commit e098867 into main Nov 21, 2026
15 of 16 checks passed
@devswha

devswha commented Nov 21, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head 36d970e2d. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit reviewed this head.

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").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant