diff --git a/.github/workflows/scandir.yml b/.github/workflows/scandir.yml index c971c91..923e1ef 100644 --- a/.github/workflows/scandir.yml +++ b/.github/workflows/scandir.yml @@ -31,11 +31,15 @@ jobs: - name: Verify check run: | - expect="testfiles/scandir/run[[:space:]]me.bash" + expect1="testfiles/scandir/run[[:space:]]me.bash" + expect2="testfiles/scandir/exec" notexpect="testfiles/test.bash" - if [[ ! "${{ steps.one.outputs.files }}" =~ $expect ]];then - echo "::error:: Expected file $expect not found in ${{ steps.one.outputs.files }}" + if [[ ! "${{ steps.one.outputs.files }}" =~ $expect1 ]];then + echo "::error:: Expected file $expect1 not found in ${{ steps.one.outputs.files }}" + exit 1 + elif [[ ! "${{ steps.one.outputs.files }}" =~ $expect2 ]];then + echo "::error:: Expected file $expect2 not found in ${{ steps.one.outputs.files }}" exit 1 elif [[ "${{ steps.one.outputs.files }}" =~ $notexpect ]];then echo "::error:: Expected file $notexpect found in ${{ steps.one.outputs.files }}" diff --git a/action.yaml b/action.yaml index 130781e..e46c41c 100644 --- a/action.yaml +++ b/action.yaml @@ -195,12 +195,16 @@ runs: ')' \ -print0) + perm_executable="/111" + # BSD find on macOS does not support the slash syntax for permissions. + [ "$(uname -s)" = "Darwin" ] && perm_executable="+111" + while IFS= read -r -d '' file; do head -n1 "$file" | grep -Eqs "$shebangregex" || continue filepaths+=("$file") done < <(find "${INPUT_SCANDIR}" \ ${INPUT_EXCLUDE_ARGS} \ - -type f ! -name '*.*' -perm /111 \ + -type f ! -name '*.*' -perm "$perm_executable" \ -print0) if [[ -n "${INPUT_CHECK_TOGETHER}" ]]; then diff --git a/testfiles/scandir/exec b/testfiles/scandir/exec new file mode 100755 index 0000000..d117d69 --- /dev/null +++ b/testfiles/scandir/exec @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo "I am executable"