3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-01-29 13:34:51 +00:00

fix: error overriding the base sha (#933)

This commit is contained in:
Tonye Jack 2023-01-05 11:12:03 -07:00 committed by GitHub
parent ebf889a3b1
commit dc4c7d50aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,21 +215,16 @@ else
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$?
fi
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
PREVIOUS_SHA=$(git rev-parse "$TARGET_BRANCH") && exit_status=$? || exit_status=$?
DIFF=".."
fi
echo "::debug::Previous SHA: $PREVIOUS_SHA"
else
PREVIOUS_SHA=$INPUT_BASE_SHA && exit_status=$? || exit_status=$?
fi
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
PREVIOUS_SHA=$(git rev-parse "$TARGET_BRANCH") && exit_status=$? || exit_status=$?
DIFF=".."
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
echo "::error::Unable find a diff between $PREVIOUS_SHA and $CURRENT_SHA"
exit 1
fi
fi
echo "::debug::Target branch: $TARGET_BRANCH"
echo "::debug::Current branch: $CURRENT_BRANCH"
@ -241,6 +236,11 @@ else
echo "::error::Please verify that the previous sha is valid, and increase the fetch_depth to a number higher than $INPUT_FETCH_DEPTH."
exit 1
fi
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
echo "::error::Unable find a diff between $PREVIOUS_SHA and $CURRENT_SHA"
exit 1
fi
fi
if [[ "$PREVIOUS_SHA" == "$CURRENT_SHA" && "$INITIAL_COMMIT" == "false" ]]; then