Skip to content

Commit 09d8260

Browse files
bpo-40548: Fix "Check for source changes (pull_request)" GH Action job (GH-21806)
On Git 2.28, "git diff master..." (3 dots) no longer works when "fetch --depth=1" is used, whereas it works on Git 2.26. Replace "..." (3 dots) with ".." (2 dots) in the "git diff" command computing the list of modified files between the base branch and the PR branch. (cherry picked from commit eaa5517) Co-authored-by: Victor Stinner <[email protected]>
1 parent 860bc0e commit 09d8260

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/build.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,20 @@ jobs:
2525
echo '::set-output name=run_tests::true'
2626
else
2727
git fetch origin $GITHUB_BASE_REF --depth=1
28-
git diff --name-only origin/$GITHUB_BASE_REF... | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
28+
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
29+
# reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots),
30+
# but it requires to download more commits (this job uses
31+
# "git fetch --depth=1").
32+
#
33+
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) works with Git
34+
# 2.26, but Git 2.28 is stricter and fails with "no merge base".
35+
#
36+
# git diff "origin/$GITHUB_BASE_REF.." (2 dots) should be enough on
37+
# GitHub, since GitHub starts by merging origin/$GITHUB_BASE_REF
38+
# into the PR branch anyway.
39+
#
40+
# https://github.com/python/core-workflow/issues/373
41+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
2942
fi
3043
build_win32:
3144
name: 'Windows (x86)'

0 commit comments

Comments
 (0)