summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-09-01 20:28:11 -0700
committerGitHub <noreply@github.com>2022-09-01 23:28:11 -0400
commit9d58933c20cd49c9a78d54483f27add6cb18138d (patch)
treed8ab7283e5de2cd1d023aaa166884d3d1994aca3
parent9da350265f4065d6381148fb3f8c79d1f058cf6d (diff)
downloadcpython-git-9d58933c20cd49c9a78d54483f27add6cb18138d.tar.gz
bpo-40548: Fix "Check for source changes (pull_request)" GH Action job (GH-21806) (GH-92342)
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 eaa551702d80fd67219c48ee6a13ffb571ca360b) Co-authored-by: Victor Stinner <vstinner@python.org>
-rw-r--r--.github/workflows/build.yml17
1 files changed, 15 insertions, 2 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index be3bbcf90b..1b1951ddb1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -26,8 +26,21 @@ jobs:
if [ -z "$GITHUB_BASE_REF" ]; then
echo '::set-output name=run_tests::true'
else
- git fetch origin $GITHUB_BASE_REF
- git diff --name-only origin/$GITHUB_BASE_REF... | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
+ git fetch origin $GITHUB_BASE_REF --depth=1
+ # git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
+ # reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots),
+ # but it requires to download more commits (this job uses
+ # "git fetch --depth=1").
+ #
+ # git diff "origin/$GITHUB_BASE_REF..." (3 dots) works with Git
+ # 2.26, but Git 2.28 is stricter and fails with "no merge base".
+ #
+ # git diff "origin/$GITHUB_BASE_REF.." (2 dots) should be enough on
+ # GitHub, since GitHub starts by merging origin/$GITHUB_BASE_REF
+ # into the PR branch anyway.
+ #
+ # https://github.com/python/core-workflow/issues/373
+ git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
fi
check_abi: