Skip to content

Commit eaa5517

Browse files
authored
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.
1 parent 4ce6faa commit eaa5517

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
@@ -32,7 +32,20 @@ jobs:
3232
echo '::set-output name=run_tests::true'
3333
else
3434
git fetch origin $GITHUB_BASE_REF --depth=1
35-
git diff --name-only origin/$GITHUB_BASE_REF... | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
35+
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
36+
# reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots),
37+
# but it requires to download more commits (this job uses
38+
# "git fetch --depth=1").
39+
#
40+
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) works with Git
41+
# 2.26, but Git 2.28 is stricter and fails with "no merge base".
42+
#
43+
# git diff "origin/$GITHUB_BASE_REF.." (2 dots) should be enough on
44+
# GitHub, since GitHub starts by merging origin/$GITHUB_BASE_REF
45+
# into the PR branch anyway.
46+
#
47+
# https://github.com/python/core-workflow/issues/373
48+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
3649
fi
3750
build_win32:
3851
name: 'Windows (x86)'

0 commit comments

Comments
 (0)