check_github_status.sh can check for user defined statuses

You can call it like this:

    ./script/ci/check_github_status.sh "pending|success"

It will check if the status is pending or success.
This commit is contained in:
Maikel Linke
2016-01-20 14:58:21 +11:00
parent 8c1a16b371
commit 1c46b8dccb

View File

@@ -15,5 +15,11 @@ echo "--- Checking environment variables"
require_env_vars OFN_COMMIT BUILDKITE_REPO
echo "--- Checking GitHub status"
if [ -n "$1" ]; then
REQUIRED_STATUS="$1"
else
REQUIRED_STATUS="success"
fi
echo "Require status '$REQUIRED_STATUS'"
echo "Visiting $GITHUB_API_URL"
curl -s "$GITHUB_API_URL" | head -n 2 | grep '^ *"state": "success",$'
curl -s "$GITHUB_API_URL" | head -n 2 | grep '^ *"state":' | egrep "\"$REQUIRED_STATUS\",\$"