Ensure shellcheck failure exit code is reflected in GH job result

This commit is contained in:
Jesper Noordsij 2024-10-08 11:58:05 +02:00 committed by GitHub
parent 0a6b8780f0
commit ab35b3266a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

View file

@ -6,6 +6,7 @@ script_dir="$( cd "$( dirname "${0}" )" && pwd -P)"
if command -v shellcheck
then
exit_code=0
# The list of shell script come from the (grep ...) command, feeding the loop
while IFS= read -r script_to_check
do
@ -18,7 +19,13 @@ then
| grep -v '.git/' | grep -v 'vendor/' | grep -v 'node_modules/' \
| cut -d':' -f1
)
wait # Wait for all background command to be completed
# Wait for all background command to be completed
for p in $(jobs -p)
do
wait "$p" || exit_code=$?
done
exit $exit_code
else
echo "== Command shellcheck not found in your PATH. No shell script checked."
exit 1
fi