#!/bin/sh # # Usage: # deployment-create-status # # Arguments: # $1 - The deployment state # $2 - The deployment description # BASEDIR=$(dirname "$0") DEPLOYMENT_ID=$("${BASEDIR}"/deployment-get-id) GITHUB_URL="https://github.com" GITHUB_API_URL="https://api.github.com" DEPLOY_STATE="${1}" DEPLOY_DESC="${2}" [ -n "${DEPLOY_DESC}" ] || DEPLOY_DESC="Deploying from GitHub Actions" echo "Setting status to ${DEPLOY_STATE} for deployment-id '${DEPLOYMENT_ID}'" curl --silent --show-error --fail \ -X POST "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/deployments/${DEPLOYMENT_ID}/statuses" \ -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: text/json; charset=utf-8" \ -H "Accept: application/vnd.github.flash-preview+json" \ -d @- <