2019-06-16 04:10:24 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
STATUS="${1}"
|
|
|
|
CI_COMMIT_SHA="${CI_COMMIT_SHA:-$(git rev-parse HEAD)}"
|
|
|
|
|
2019-11-10 02:00:54 +00:00
|
|
|
STATUS_BODY="$(cat <<EOF
|
|
|
|
{
|
|
|
|
"state": "${STATUS}",
|
|
|
|
"target_url": "${CI_PIPELINE_URL}",
|
|
|
|
"description": "CI pipeline ${STATUS}!",
|
|
|
|
"context": "gitlab/build"
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
)"
|
2019-06-16 04:10:24 +00:00
|
|
|
|
|
|
|
printf "Reporting status for %s...\n%s" "${CI_COMMIT_SHA}" "${STATUS_BODY}"
|
|
|
|
printf "%s" "${STATUS_BODY}" | curl -d @- \
|
|
|
|
-H "Authorization: token $(printf "%s" "${GITHUB_SECRET}" | base64 -d)" \
|
2019-06-29 16:39:49 +00:00
|
|
|
-i "https://api.github.com/repos/${CI_PROJECT_PATH}/statuses/${CI_COMMIT_SHA}"
|