From e2eafd86de01abe0aac06f369c09808c758e025c Mon Sep 17 00:00:00 2001 From: glx22 Date: Thu, 10 Dec 2020 00:31:03 +0100 Subject: Fix: Prevent infinite recursion in commit checker --- .github/workflows/commit-checker.yml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.github/workflows') diff --git a/.github/workflows/commit-checker.yml b/.github/workflows/commit-checker.yml index d2546ab30..d83183a46 100644 --- a/.github/workflows/commit-checker.yml +++ b/.github/workflows/commit-checker.yml @@ -24,6 +24,12 @@ jobs: # 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 -- cgit v1.2.3-54-g00ecf