1
0
Fork 0
mirror of https://github.com/ludeeus/action-shellcheck.git synced 2024-08-16 10:09:53 +02:00
shellcheck/runaction.sh
2020-05-30 00:12:17 +02:00

63 lines
No EOL
1.4 KiB
Bash
Executable file

#!/bin/bash
cd "$GITHUB_WORKSPACE" || exit 1
declare err
declare -a filepaths
declare -a tmp
err=0
readarray -d '' filepaths < <(find . '(' \
\
-name '*.bash' \
-o -path '*/.bash*' \
-o -path '*/bash*' \
-o -name '*.ksh' \
-o -name 'ksh*' \
-o -path '*/.ksh*' \
-o -path '*/ksh*' \
-o -name 'suid_profile' \
-o -name '*.zsh' \
-o -name '.zlogin*' \
-o -name 'zlogin*' \
-o -name '.zlogout*' \
-o -name 'zlogout*' \
-o -name '.zprofile*' \
-o -name 'zprofile*' \
-o -path '*/.zsh*' \
-o -path '*/zsh*' \
-o -name '*.sh' \
-o -path '*/.profile*' \
-o -path '*/profile*' \
-o -path '*/.shlib*' \
-o -path '*/shlib*' \
')'\
\
-print0)
readarray -d '' tmp < <(find . -type f ! -name '*.*' -perm /111 -print0)
for file in "${tmp[@]}"; do
head -n1 "$file" | grep -Eqs "^#! */[^ ]*/[abkz]*sh" || continue
filepaths+=("$file")
done
if find . -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 |
grep .
then
echo >&2 "::warning:: programs in PATH should not have a filename suffix"
fi
for file in "${filepaths[@]}"; do
echo "::debug:: Checking $file"
shellcheck "$file" || err=$?
done
exit "$err"