Skip to content

Commit 5de53cc

Browse files
author
Marc Stern
committed
handles the case grep doesn't match, otherwise the script exits with 1 (error)
1 parent f5bbb0b commit 5de53cc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,12 @@ jobs:
5151
run: sudo systemctl restart apache2.service
5252
- name: Search for errors/warnings in error log
5353
run: |
54-
errors=$(grep -E ':(?error|warn)[]]' /var/log/apache2/error.log)
55-
if [[ -n "${errors}" ]]; then
56-
echo "Found errors/warnings in error.log"
57-
echo "${errors}"
58-
exit 1
59-
fi
60-
exit 0
54+
# '|| :' handles the case grep doesn't match, otherwise the script exits with 1 (error)
55+
errors=$(grep -E ':(?error|warn)[]]' /var/log/apache2/error.log) || :
56+
if [[ -z "${errors}" ]]; then exit 0; fi
57+
echo "Found errors/warnings in error.log"
58+
echo "${errors}"
59+
exit 1
6160
- name: Show httpd error log
6261
if: always()
6362
run: sudo cat /var/log/apache2/error.log

0 commit comments

Comments
 (0)