mirror of
https://github.com/ludeeus/action-shellcheck.git
synced 2025-01-18 17:41:58 +01:00
restructure
This commit is contained in:
parent
b443c466bf
commit
f615dc5486
77
runaction.sh
Normal file → Executable file
77
runaction.sh
Normal file → Executable file
@ -1,48 +1,63 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
cd "$GITHUB_WORKSPACE" || exit 1
|
cd "$GITHUB_WORKSPACE" || exit 1
|
||||||
|
|
||||||
|
declare err
|
||||||
|
declare -a filepaths
|
||||||
|
declare -a tmp
|
||||||
|
|
||||||
err=0
|
err=0
|
||||||
|
|
||||||
find . '(' -name '*.bash' \
|
readarray -d '' filepaths < <(find . '(' \
|
||||||
-o -path '*/.bash*' -o -path '*/bash*' \
|
\
|
||||||
\
|
-name '*.bash' \
|
||||||
-o -name '*.ksh' \
|
-o -path '*/.bash*' \
|
||||||
-o -name 'ksh*' \
|
-o -path '*/bash*' \
|
||||||
-o -path '*/.ksh*' -o -path '*/ksh*' \
|
-o -name '*.ksh' \
|
||||||
-o -name 'suid_profile' \
|
-o -name 'ksh*' \
|
||||||
\
|
-o -path '*/.ksh*' \
|
||||||
-o -name '*.zsh' \
|
-o -path '*/ksh*' \
|
||||||
-o -name '.zlogin*' -o -name 'zlogin*' \
|
-o -name 'suid_profile' \
|
||||||
-o -name '.zlogout*' -o -name 'zlogout*' \
|
-o -name '*.zsh' \
|
||||||
-o -name '.zprofile*' -o -name 'zprofile*' \
|
-o -name '.zlogin*' \
|
||||||
-o -path '*/.zsh*' -o -path '*/zsh*' \
|
-o -name 'zlogin*' \
|
||||||
\
|
-o -name '.zlogout*' \
|
||||||
-o -name '*.sh' \
|
-o -name 'zlogout*' \
|
||||||
-o -path '*/.profile*' -o -path '*/profile*' \
|
-o -name '.zprofile*' \
|
||||||
-o -path '*/.shlib*' -o -path '*/shlib*' \
|
-o -name 'zprofile*' \
|
||||||
')' -exec shellcheck {} + || err=1
|
-o -path '*/.zsh*' \
|
||||||
|
-o -path '*/zsh*' \
|
||||||
|
-o -name '*.sh' \
|
||||||
|
-o -path '*/.profile*' \
|
||||||
|
-o -path '*/profile*' \
|
||||||
|
-o -path '*/.shlib*' \
|
||||||
|
-o -path '*/shlib*' \
|
||||||
|
')'\
|
||||||
|
\
|
||||||
|
-print0)
|
||||||
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
find . -type f ! -name '*.*' -perm /111 -exec sh -c '
|
readarray -d '' tmp < <(find . -type f ! -name '*.sh' -perm /111 -print0)
|
||||||
for f
|
for file in "${tmp[@]}"; do
|
||||||
do
|
head -n1 "$file" | grep -Eqs "^#! */[^ ]*/[abkz]*sh" || continue
|
||||||
head -n1 "$f" | grep -Eqs "^#! */[^ ]*/[abkz]*sh" || continue
|
filepaths+=("$file")
|
||||||
shellcheck "$f" || err=$?
|
done
|
||||||
done
|
|
||||||
exit $err
|
|
||||||
' _ {} + || err=1
|
|
||||||
|
|
||||||
if find . -path '*bin/*/*' -type f -perm /111 -print |
|
if find . -path '*bin/*/*' -type f -perm /111 -print |
|
||||||
grep .
|
grep .
|
||||||
then
|
then
|
||||||
echo >&2 "WARNING: subdirectories of bin directories are not usable via PATH"
|
echo >&2 "::warning:: subdirectories of bin directories are not usable via PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if find . -path '*bin/*' -name '*.*' -type f -perm /111 -perm /444 -print |
|
if find . -path '*bin/*' -name '*.*' -type f -perm /111 -perm /444 -print |
|
||||||
grep .
|
grep .
|
||||||
then
|
then
|
||||||
echo >&2 "WARNING: programs in PATH should not have a filename suffix"
|
echo >&2 "::warning:: programs in PATH should not have a filename suffix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit "$err"
|
for file in "${filepaths[@]}"; do
|
||||||
|
echo "::debug:: Checking $file"
|
||||||
|
shellcheck "$file" || err=$?
|
||||||
|
done
|
||||||
|
|
||||||
|
exit "$err"
|
Loading…
x
Reference in New Issue
Block a user