3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-01-17 09:17:46 +00:00

fix: bug with invalid branch name

This commit is contained in:
Tonye Jack 2022-11-08 09:00:45 -07:00
parent 77f03d2bb5
commit 9962dc418e

View file

@ -45,8 +45,6 @@ fi
if [[ -z $GITHUB_BASE_REF ]]; then
echo "Running on a push event..."
TARGET_BRANCH=${GITHUB_REF/refs\/heads\//} && exit_status=$? || exit_status=$?
CURRENT_BRANCH=$TARGET_BRANCH && exit_status=$? || exit_status=$?
echo "::debug::Getting HEAD SHA..."
if [[ -n "$INPUT_UNTIL" ]]; then
@ -67,6 +65,9 @@ if [[ -z $GITHUB_BASE_REF ]]; then
fi
fi
TARGET_BRANCH=$(git name-rev --name-only "$CURRENT_SHA" 2>&1) && exit_status=$? || exit_status=$?
CURRENT_BRANCH=$TARGET_BRANCH && exit_status=$? || exit_status=$?
echo "::debug::Verifying the current commit SHA: $CURRENT_SHA"
git rev-parse --quiet --verify "$CURRENT_SHA^{commit}" 1>/dev/null 2>&1 && exit_status=$? || exit_status=$?
@ -127,8 +128,6 @@ if [[ -z $GITHUB_BASE_REF ]]; then
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -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
fi
echo "::debug::Target branch $TARGET_BRANCH..."