1
- #! /usr/bin/env sh
1
+ #! /usr/bin/env bash
2
2
set -eu
3
3
4
4
FILES_WITH_WRONG_PERMISSIONS=$(
@@ -12,28 +12,28 @@ BIN_FILES_WITH_WRONG_PERMISSIONS=$(
12
12
| sort -fh
13
13
)
14
14
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'
18
18
echo " $FILES_WITH_WRONG_PERMISSIONS "
19
19
echo ' '
20
20
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::'
22
22
fi
23
23
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'
27
27
echo " $BIN_FILES_WITH_WRONG_PERMISSIONS "
28
28
echo ' '
29
29
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::'
31
31
fi
32
32
33
- if [ -n " $FILES_WITH_WRONG_PERMISSIONS " ]; then
33
+ if [[ -n " $FILES_WITH_WRONG_PERMISSIONS " ] ]; then
34
34
exit 3
35
- elif [ -n " $BIN_FILES_WITH_WRONG_PERMISSIONS " ]; then
35
+ elif [[ -n " $BIN_FILES_WITH_WRONG_PERMISSIONS " ] ]; then
36
36
exit 4
37
37
fi
38
38
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