3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-16 19:27:39 +00:00

Update diff-sha.sh

This commit is contained in:
Tonye Jack 2022-12-09 23:52:38 -07:00 committed by GitHub
parent fbc9b61579
commit 0707f1b441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,11 +7,16 @@ GITHUB_OUTPUT=${GITHUB_OUTPUT:-""}
EXTRA_ARGS="--no-tags"
PREVIOUS_SHA=""
CURRENT_SHA=""
DIFF="..."
if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
EXTRA_ARGS=""
fi
if [[ "$GITHUB_EVENT_HEAD_REPO_FORK" == "true" ]]; then
DIFF=".."
fi
echo "::group::changed-files-diff-sha"
if [[ -n $INPUT_PATH ]]; then
@ -205,7 +210,7 @@ else
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$?
fi
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA"..."$CURRENT_SHA" 1>/dev/null 2>&1; then
if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then
PREVIOUS_SHA=$(git rev-parse origin/"$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
fi
fi