Update diff-sha.sh

This commit is contained in:
Tonye Jack 2022-11-04 11:54:46 -06:00 committed by GitHub
parent 6079b26874
commit 84396edc7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then
if [[ -z $INPUT_SHA ]]; then
CURRENT_SHA=$(git rev-list -n 1 HEAD 2>&1) && exit_status=$? || exit_status=$?
else
git fetch --no-tags -u --progress --deepen="$INPUT_FETCH_DEPTH"
git fetch --no-tags -u --progress --depth="$INPUT_FETCH_DEPTH" "$CURRENT_BRANCH":"$CURRENT_BRANCH"
CURRENT_SHA=$INPUT_SHA; exit_status=$?
fi
fi
@ -82,7 +82,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then
exit 1
fi
else
git fetch --no-tags -u --progress --deepen="$INPUT_FETCH_DEPTH"
git fetch --no-tags -u --progress --depth="$INPUT_FETCH_DEPTH" "$CURRENT_BRANCH":"$CURRENT_BRANCH"
PREVIOUS_SHA=$(git rev-list -n 1 "$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
if [[ -z "$PREVIOUS_SHA" ]]; then
@ -111,10 +111,10 @@ if [[ -z $GITHUB_BASE_REF ]]; then
fi
fi
else
git fetch --no-tags -u --progress --deepen="$INPUT_FETCH_DEPTH"
PREVIOUS_SHA=$INPUT_BASE_SHA
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$?
CURRENT_BRANCH=$TARGET_BRANCH
git fetch --no-tags -u --progress --depth="$INPUT_FETCH_DEPTH" "$CURRENT_BRANCH":"$CURRENT_BRANCH"
fi
echo "::debug::Target branch $TARGET_BRANCH..."
@ -134,7 +134,7 @@ else
CURRENT_BRANCH=$GITHUB_HEAD_REF
echo "Fetching remote refs..."
git fetch --no-tags -u --progress --deepen=40000 origin "$CURRENT_BRANCH":"$CURRENT_BRANCH"
git fetch --no-tags -u --progress --depth=40000 origin "$CURRENT_BRANCH":"$CURRENT_BRANCH"
git fetch --no-tags -u --progress --depth="$INPUT_FETCH_DEPTH" origin "$TARGET_BRANCH":"$TARGET_BRANCH"
echo "::debug::Getting HEAD SHA..."