summaryrefslogtreecommitdiff
path: root/.github/workflows/commit-checker.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/commit-checker.yml')
-rw-r--r--.github/workflows/commit-checker.yml34
1 files changed, 2 insertions, 32 deletions
diff --git a/.github/workflows/commit-checker.yml b/.github/workflows/commit-checker.yml
index d83183a46..acf622a87 100644
--- a/.github/workflows/commit-checker.yml
+++ b/.github/workflows/commit-checker.yml
@@ -15,37 +15,7 @@ jobs:
fetch-depth: 4
- name: Get pull-request commits
- run: |
- set -x
- # actions/checkout did a merge checkout of the pull-request. As such, the first
- # commit is the merge commit. This means that on HEAD^ is the base branch, and
- # on HEAD^2 are the commits from the pull-request. We now check if those trees
- # have a common parent. If not, we fetch a few more commits till we do. In result,
- # the log between HEAD^ and HEAD^2 will be the commits in the pull-request.
- DEPTH=4
- while [ -z "$(git merge-base HEAD^ HEAD^2)" ]; do
- # Prevent infinite recursion
- if [ ${DEPTH} -gt 256 ]; then
- echo "No common parent between '${GITHUB_HEAD_REF}' and '${GITHUB_BASE_REF}'." >&2
- exit 1
- fi
-
- git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --deepen=${DEPTH} origin HEAD
- DEPTH=$(( ${DEPTH} * 4 ))
- done
-
- # Just to show which commits we are going to evaluate.
- git log --oneline HEAD^..HEAD^2
-
- - name: Checkout commit-checker
- uses: actions/checkout@v2
- with:
- repository: OpenTTD/OpenTTD-git-hooks
- path: git-hooks
- ref: master
+ uses: OpenTTD/actions/checkout-pull-request@v2
- name: Check commits
- run: |
- set -x
- HOOKS_DIR=./git-hooks/hooks GIT_DIR=.git ./git-hooks/hooks/check-commits.sh HEAD^..HEAD^2
- echo "Commit checks passed"
+ uses: OpenTTD/OpenTTD-git-hooks@main