Cirrus: Fix tag & branch go checks failing

When running on a branch or tag, `req_env_vars()` will call `exit(1)`
because `$CIRRUS_PR` is empty (as expected).  The original intention was
to simply skip language checks on non-PRs.  Fix the condition to match.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich 2022-10-03 12:09:07 -04:00
parent ddf36e0649
commit 62bc8e3a18
No known key found for this signature in database
GPG Key ID: 03EDC70FD578067F
1 changed files with 11 additions and 3 deletions

View File

@ -30,9 +30,17 @@ $(egrep -B 5 -A 5 "$regex"<<<"$diffs")"
fi fi
} }
if [[ -n "$CIRRUS_TAG" ]] || ! req_env_vars CIRRUS_CHANGE_IN_REPO CIRRUS_PR DEST_BRANCH # Defined by Cirrus-CI
then # shellcheck disable=SC2154
warn "Skipping: Golang code checks cannot run in this context" if [[ "$CIRRUS_BRANCH" =~ pull ]]; then
for var in CIRRUS_CHANGE_IN_REPO CIRRUS_PR DEST_BRANCH; do
if [[ -z "${!var}" ]]; then
warn "Skipping: Golang code checks require non-empty '\$$var'"
exit 0
fi
done
else
warn "Skipping: Golang code checks in tag and branch contexts"
exit 0 exit 0
fi fi