Skip to content

Commit

Permalink
Merge pull request ludeeus#1 from rwalker-apple/Add-support-for-EXCLU…
Browse files Browse the repository at this point in the history
…DED_DIRS

add support for EXCLUDE_DIRS
  • Loading branch information
Rob Walker committed Mar 23, 2020
2 parents 746dd2d + 03e2031 commit 1e7fa65
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions runaction.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
#!/bin/sh
#!/bin/bash

cd "$GITHUB_WORKSPACE" || exit

find . '(' -name '*.bash' \
EXCLUDES=()

# shellcheck disable=SC2206
for dir in ${EXCLUDE_DIRS}; do
# all find results start with './'
[[ ${dir#./*} != $dir ]] || dir=./${dir}
EXCLUDES+=( ! -path "$dir/*" -a )
done

find . "${EXCLUDES[@]}" \
'(' -name '*.bash' \
-o -path '*/.bash*' -o -path '*/bash*' \
\
-o -name '*.ksh' \
Expand All @@ -22,7 +32,7 @@ find . '(' -name '*.bash' \
')' -exec shellcheck {} + || exit

# shellcheck disable=SC2016
find . -type f ! -name '*.*' -perm /111 -exec sh -c '
find . "${EXCLUDES[@]}" -type f ! -name '*.*' -perm /111 -exec sh -c '
for f
do
head -n1 "$f" | grep -Eqs "^#! */[^ ]*/[abkz]*sh" || continue
Expand All @@ -31,13 +41,13 @@ find . -type f ! -name '*.*' -perm /111 -exec sh -c '
exit $err
' _ {} + || exit

if find . -path '*bin/*/*' -type f -perm /111 -print |
if find . "${EXCLUDES[@]}" -path '*bin/*/*' -type f -perm /111 -print |
grep .
then
echo >&2 "WARNING: subdirectories of bin directories are not usable via PATH"
fi

if find . -path '*bin/*' -name '*.*' -type f -perm /111 -perm /444 -print |
if find . "${EXCLUDES[@]}" -path '*bin/*' -name '*.*' -type f -perm /111 -perm /444 -print |
grep .
then
echo >&2 "WARNING: programs in PATH should not have a filename suffix"
Expand Down

0 comments on commit 1e7fa65

Please sign in to comment.