aboutsummaryrefslogtreecommitdiffstats
path: root/tools/check-commits.sh
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-08-06 08:28:18 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-08-06 11:49:45 +0200
commit4ca1c0ea446d2c09b1fb49a85ae645e3754f1058 (patch)
treeccaceb3423c45210fb301f9e79b16b16f1eaefea /tools/check-commits.sh
parentf94b533a4b8d84b61facdcb97e4f1fb343393ceb (diff)
tools/check-commits.sh: use PR head instead of base
Base points to already commetted changes, we really want to cheack head of the PR.
Diffstat (limited to 'tools/check-commits.sh')
-rwxr-xr-xtools/check-commits.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/check-commits.sh b/tools/check-commits.sh
index 42cd72d95..b83031e02 100755
--- a/tools/check-commits.sh
+++ b/tools/check-commits.sh
@@ -4,13 +4,13 @@
set -e
-# .github/workflows/ci.yml passes GITHUB_PR_BASE_SHA and GITHUB_PR_COMMITS for pull requests.
+# .github/workflows/ci.yml passes GITHUB_PR_HEAD_SHA and GITHUB_PR_COMMITS for pull requests.
# That's the range we want to check for PRs. If these are not set, we check from the current HEAD
# to the master branch (presumably a local run). If master does not exist (presumably CI run on
# a commit into a fork tree), check HEAD commit only.
-GITHUB_PR_BASE_SHA="${GITHUB_PR_BASE_SHA:-HEAD}"
+GITHUB_PR_HEAD_SHA="${GITHUB_PR_HEAD_SHA:-HEAD}"
if [ "${GITHUB_PR_COMMITS}" == "" ]; then
- GITHUB_PR_COMMITS=`git log --oneline master..${GITHUB_PR_BASE_SHA} | wc -l`
+ GITHUB_PR_COMMITS=`git log --oneline master..${GITHUB_PR_HEAD_SHA} | wc -l`
if [ "${GITHUB_PR_COMMITS}" == "" ] || [ "${GITHUB_PR_COMMITS}" == "0" ]; then
GITHUB_PR_COMMITS=1
fi
@@ -18,7 +18,7 @@ fi
COMMITS=0
FAILED=""
-HASHES=$(git log --format="%h" -n ${GITHUB_PR_COMMITS} ${GITHUB_PR_BASE_SHA})
+HASHES=$(git log --format="%h" -n ${GITHUB_PR_COMMITS} ${GITHUB_PR_HEAD_SHA})
for HASH in ${HASHES}; do
((COMMITS+=1))
SUBJECT=$(git show --format="%s" --no-patch ${HASH})
@@ -37,5 +37,5 @@ for HASH in ${HASHES}; do
FAILED="1"
fi
done
+echo "$COMMITS commits checked for format style (git log -n ${GITHUB_PR_COMMITS} ${GITHUB_PR_HEAD_SHA})"
if [ "$FAILED" != "" ]; then exit 1; fi
-echo "$COMMITS commits checked for format style"