3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-02-06 19:41:20 +00:00

Merge pull request #786 from tj-actions/fix/bug-with-invalid-branch-name

This commit is contained in:
Tonye Jack 2022-11-08 09:43:38 -07:00 committed by GitHub
commit 6326c61a70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -127,9 +127,9 @@ jobs:
until: "2022-08-20" until: "2022-08-20"
- name: Check output - name: Check output
if: "!contains(steps.changed-files-until.outputs.all_changed_files, 'entrypoint.sh')" if: "!contains(steps.changed-files-until.outputs.all_changed_files, 'README.md')"
run: | run: |
echo "Invalid output: Expected to include (entrypoint.sh) got (${{ steps.changed-files-until.outputs.all_changed_files }})" echo "Invalid output: Expected to include (README.md) got (${{ steps.changed-files-until.outputs.all_changed_files }})"
exit 1 exit 1
shell: shell:
bash bash

View file

@ -45,8 +45,6 @@ fi
if [[ -z $GITHUB_BASE_REF ]]; then if [[ -z $GITHUB_BASE_REF ]]; then
echo "Running on a push event..." 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..." echo "::debug::Getting HEAD SHA..."
if [[ -n "$INPUT_UNTIL" ]]; then if [[ -n "$INPUT_UNTIL" ]]; then
@ -67,6 +65,9 @@ if [[ -z $GITHUB_BASE_REF ]]; then
fi fi
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" 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=$? 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 # shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH"
PREVIOUS_SHA=$INPUT_BASE_SHA 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 fi
echo "::debug::Target branch $TARGET_BRANCH..." echo "::debug::Target branch $TARGET_BRANCH..."