Skip to content

Commit c4c4ff2

Browse files
authored
ci: use merge-base diff for PR GPU tests (#5224)
1 parent de2df38 commit c4c4ff2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/python.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,13 @@ jobs:
7979
if [ "${{ github.event_name }}" = "pull_request" ]; then
8080
base_sha="${{ github.event.pull_request.base.sha }}"
8181
head_sha="${{ github.event.pull_request.head.sha }}"
82+
# Match GitHub's PR diff: exclude commits added to the base branch
83+
# after the PR branch diverged.
84+
diff_range="$base_sha...$head_sha"
8285
else
8386
base_sha="${{ github.event.before }}"
8487
head_sha="${{ github.sha }}"
88+
diff_range="$base_sha..$head_sha"
8589
fi
8690
8791
full=false
@@ -90,7 +94,7 @@ jobs:
9094
# Fall back to a full run when there is no usable diff base (new
9195
# branch, or a force push whose previous head no longer exists).
9296
if [ -z "$base_sha" ] || [[ "$base_sha" =~ ^0+$ ]] \
93-
|| ! git diff --name-only "$base_sha" "$head_sha" > changed-files.txt 2>/dev/null; then
97+
|| ! git diff --name-only "$diff_range" > changed-files.txt 2>/dev/null; then
9498
full=true
9599
else
96100
# Map each changed path to the GPU test group(s) it affects.

0 commit comments

Comments
 (0)