From 5b43f918391d796bc464cb0cbd537cbe75d3a4ea Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Fri, 4 Nov 2022 16:31:48 -0600 Subject: [PATCH] Update diff-sha.sh --- diff-sha.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/diff-sha.sh b/diff-sha.sh index ef7428a8..190c1cc1 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -137,8 +137,16 @@ else git fetch --depth="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" || true + depth=$INPUT_FETCH_DEPTH + while [ -z "$( git merge-base "$TARGET_BRANCH" HEAD )" ]; do - git fetch --deepen="$INPUT_FETCH_DEPTH" origin "$TARGET_BRANCH" HEAD; + git fetch --deepen="$depth" origin "$TARGET_BRANCH" HEAD; + depth=$((depth * 10)) + max_depth=3000 + + if [[ $depth -gt $max_depth ]]; then + echo "::error::Unable to find merge-base of $TARGET_BRANCH and HEAD." + fi done echo "::debug::Getting HEAD SHA..."