Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci: resolve PR base branch at runtime for detect-changes diff
copy-pr-bot mirrors every PR to a pull-request/<N> branch regardless
of whether the upstream PR targets main or a backport branch such as
12.9.x. Diffing against origin/main unconditionally therefore
misclassifies changed paths on backport PRs and silently suppresses
the cuda.bindings test matrix.

Look up the real base ref via nv-gha-runners/get-pr-info (already used
elsewhere in this repo) and pass it to git merge-base so the changed-
paths classification matches the PR's actual target.
  • Loading branch information
cpcloud committed Apr 16, 2026
commit f410ba657fa9ba19e63875440abfd4c7fad13c97
21 changes: 18 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,29 @@ jobs:
with:
fetch-depth: 0

# copy-pr-bot pushes every PR (whether it targets main or a backport
# branch such as 12.9.x) to pull-request/<N>, so the base branch
# cannot be inferred from github.ref_name. Look it up via the
# upstream PR metadata so the diff below is rooted at the right place.
- name: Resolve PR base branch
id: pr-info
if: ${{ startsWith(github.ref_name, 'pull-request/') }}
uses: nv-gha-runners/get-pr-info@main

- name: Detect changed paths
id: filter
if: ${{ startsWith(github.ref_name, 'pull-request/') }}
env:
BASE_REF: ${{ fromJSON(steps.pr-info.outputs.pr-info).base.ref }}
run: |
# Diff against the merge base with the default branch. Uses
# merge-base so diverged branches only show files changed on
# Diff against the merge base with the PR's actual target branch.
# Uses merge-base so diverged branches only show files changed on
# the PR side, not upstream commits.
base=$(git merge-base HEAD origin/main)
if [[ -z "${BASE_REF}" ]]; then
echo "Could not resolve PR base branch from get-pr-info output" >&2
exit 1
fi
base=$(git merge-base HEAD "origin/${BASE_REF}")
changed=$(git diff --name-only "$base"...HEAD)

has_match() {
Expand Down