1- #! /usr/bin/env sh
1+ #! /usr/bin/env bash
22set -eu
33
44FILES_WITH_WRONG_PERMISSIONS=$(
@@ -12,28 +12,28 @@ BIN_FILES_WITH_WRONG_PERMISSIONS=$(
1212 | sort -fh
1313)
1414
15- if [ -n " $FILES_WITH_WRONG_PERMISSIONS " ]; then
16- printf ' \033[31mFAIL \033[0m Non-executable files with +x permissions were detected!\n'
17- [ -z " ${GITHUB_ACTIONS+x} " ] || echo ' ::group::Non-executable files'
15+ if [[ -n " $FILES_WITH_WRONG_PERMISSIONS " ] ]; then
16+ printf ' \033[41m FAIL \033[0m Non-executable files with +x permissions were detected!\n'
17+ [[ -z " ${GITHUB_ACTIONS+x} " ] ] || echo ' ::group::Non-executable files'
1818 echo " $FILES_WITH_WRONG_PERMISSIONS "
1919 echo ' '
2020 echo " $FILES_WITH_WRONG_PERMISSIONS " | awk ' {print $4}' | xargs -n1 printf ' Please run "\033[32msudo chmod\033[0m -x %s".\n'
21- [ -z " ${GITHUB_ACTIONS+x} " ] || echo ' ::endgroup::'
21+ [[ -z " ${GITHUB_ACTIONS+x} " ] ] || echo ' ::endgroup::'
2222fi
2323
24- if [ -n " $BIN_FILES_WITH_WRONG_PERMISSIONS " ]; then
25- printf ' \033[31mFAIL \033[0m Executable files with -x permissions were detected!\n'
26- [ -z " ${GITHUB_ACTIONS+x} " ] || echo ' ::group::Executable files'
24+ if [[ -n " $BIN_FILES_WITH_WRONG_PERMISSIONS " ] ]; then
25+ printf ' \033[41m FAIL \033[0m Executable files with -x permissions were detected!\n'
26+ [[ -z " ${GITHUB_ACTIONS+x} " ] ] || echo ' ::group::Executable files'
2727 echo " $BIN_FILES_WITH_WRONG_PERMISSIONS "
2828 echo ' '
2929 echo $BIN_FILES_WITH_WRONG_PERMISSIONS | awk ' {print $4}' | xargs -n1 printf ' Please run "\033[32msudo chmod\033[0m +x %s".\n'
30- [ -z " ${GITHUB_ACTIONS+x} " ] || echo ' ::endgroup::'
30+ [[ -z " ${GITHUB_ACTIONS+x} " ] ] || echo ' ::endgroup::'
3131fi
3232
33- if [ -n " $FILES_WITH_WRONG_PERMISSIONS " ]; then
33+ if [[ -n " $FILES_WITH_WRONG_PERMISSIONS " ] ]; then
3434 exit 3
35- elif [ -n " $BIN_FILES_WITH_WRONG_PERMISSIONS " ]; then
35+ elif [[ -n " $BIN_FILES_WITH_WRONG_PERMISSIONS " ] ]; then
3636 exit 4
3737fi
3838
39- printf ' \033[32mOK \033[0m No wrong permissions were detected.\n'
39+ printf ' \033[42m OK \033[0m No wrong permissions were detected.\n'
0 commit comments