Skip to content

Commit f8d9869

Browse files
committed
semver_checks CI: fail when something in script fails
1 parent 8632592 commit f8d9869

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/semver_checks.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@ jobs:
6363
- name: Verify the API compatibilty with PR base
6464
id: semver-pr-check
6565
run: |
66-
set +e
66+
set -e # So that failed commands exit the script
67+
set -o pipefail # So that if a command in a pipe fails, the whole command fails
68+
6769
echo "output<<SEMVER_STDOUT_EOF" >> $GITHUB_OUTPUT
70+
SEMVER_REV_OUTPUT=$(make semver-rev rev="$PR_BASE" 2>&1) && true # "&& true" preserves exit code but cancels effects of set -e
71+
exitcode=$?
72+
6873
# Weird sed strip ANSI colors from output
69-
make semver-rev rev="$PR_BASE" |& tee /proc/self/fd/2 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" >> $GITHUB_OUTPUT
70-
exitcode=${PIPESTATUS[0]}
74+
# If any of the commands below fail, `set -e` and `set -o pipefail` should exit the script
75+
echo "${SEMVER_REV_OUTPUT}" | tee /proc/self/fd/2 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" >> $GITHUB_OUTPUT
7176
echo "SEMVER_STDOUT_EOF" >> $GITHUB_OUTPUT
7277
7378
echo "Semver checks exitcode: " $exitcode

0 commit comments

Comments
 (0)