[build] derive PR diff base from HEAD^1 instead of trunk tip#17438
[build] derive PR diff base from HEAD^1 instead of trunk tip#17438titusfortner wants to merge 1 commit into
Conversation
Review Summary by QodoFix PR diff base calculation to use parent commit
WalkthroughsDescription• Fix PR diff base calculation to use parent commit instead of trunk • Remove unnecessary base ref fetch from bazel workflow • Calculate BASE_SHA from HEAD~PR_COMMITS for accurate PR comparisons • Fallback to github.event.before when PR_COMMITS unavailable Diagramflowchart LR
A["PR Event"] -->|Extract PR_COMMITS| B["Calculate BASE_SHA"]
B -->|HEAD~PR_COMMITS| C["Parent Commit"]
C -->|Diff Range| D["Affected Targets"]
A -->|Fallback| E["github.event.before"]
E --> D
File Changes1. .github/workflows/bazel.yml
|
Code Review by Qodo
1. HEAD^1 base unverified
|
There was a problem hiding this comment.
Pull request overview
This PR updates the GitHub Actions CI target-selection logic so PR “affected targets” are computed against the PR’s parent commit history rather than the current trunk head, reducing unnecessary Bazel test execution.
Changes:
- In CI “Check Targets”, compute
BASE_SHAfor PR diffs usingHEAD_SHA~PR_COMMITS(fallback togithub.event.beforefor non-PR events). - Remove the extra
git fetchofpull_request.base.shain the reusable Bazel workflow.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| .github/workflows/ci.yml | Changes how the diff base SHA is computed for affected target calculation in PR/push contexts. |
| .github/workflows/bazel.yml | Removes an explicit fetch of the PR base SHA, relying on the initial checkout depth instead. |
b026711 to
5836478
Compare
|
Persistent review updated to latest commit 5836478 |
5836478 to
b82fd93
Compare
|
Persistent review updated to latest commit b82fd93 |
💥 What does this PR do?
Our check targets job for running PRs has been incorrectly comparing the PR to current trunk (with pull_request.base) instead of to the parent merge commit (HEAD^1), resulting in more things being tested than necessary.
GitHub's auto-merge commit (refs/pull/N/merge) is checked out as HEAD.
HEAD^1 is the base branch tip; diffing it against HEAD shows what the merge introduces - i.e. the PR's effective changes.
The bazel.yml workflow checks out to a depth of PR_COMMITS + 2 to ensure that the merge commits will be present
🔄 Types of changes