mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
New CI script to check test state via GitHub API
This commit is contained in:
19
script/ci/check_github_status.sh
Executable file
19
script/ci/check_github_status.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
source "`dirname $0`/includes.sh"
|
||||
|
||||
OFN_COMMIT=$(get_ofn_commit)
|
||||
if [ "$OFN_COMMIT" = 'OFN_COMMIT_NOT_FOUND' ]; then
|
||||
OFN_COMMIT=$(git rev-parse $BUILDKITE_COMMIT)
|
||||
fi
|
||||
|
||||
GITHUB_REPO="$(echo $BUILDKITE_REPO | sed 's/git@github.com:\(.*\).git/\1/')"
|
||||
GITHUB_API_URL="https://api.github.com/repos/$GITHUB_REPO/commits/$OFN_COMMIT/status"
|
||||
|
||||
echo "--- Checking environment variables"
|
||||
require_env_vars OFN_COMMIT BUILDKITE_REPO
|
||||
|
||||
echo "--- Checking GitHub status"
|
||||
echo "Visiting $GITHUB_API_URL"
|
||||
curl -s "$GITHUB_API_URL" | head -n 2 | grep '^ *"state": "success",$'
|
||||
Reference in New Issue
Block a user