Work around test -v not being available in Mac Bash

This commit is contained in:
Henry Mercer
2022-09-01 16:49:39 +01:00
parent 1d311fe8e5
commit 6699d47420
2 changed files with 8 additions and 2 deletions

View File

@@ -93,7 +93,10 @@ jobs:
TEST_MODE: true
- shell: bash
run: |
if [[ -v CODEQL_ACTION_DID_AUTOBUILD_GOLANG ]]; then
# Once we start running Bash 4.2 in all environments, we can replace the
# `! -z` flag with the more elegant `-v` which confirms that the variable
# is actually unset and not potentially set to a blank value.
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
echo "Expected the Go autobuilder not to be run, but the" \
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
exit 1