Skip to content

Instantly share code, notes, and snippets.

@homeyer
Last active February 15, 2018 08:51
Show Gist options
  • Save homeyer/0840246d6544dac2d97d8aa8a86fa541 to your computer and use it in GitHub Desktop.
Save homeyer/0840246d6544dac2d97d8aa8a86fa541 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Notify GitHub of a successful deployment
notify_gh_about_a_deployment () {
declare -r deployment_id=${1}
declare -r deployment_status=${2}
curl -s -X POST "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/deployments/${deployment_id}/statuses" \
-H 'Content-Type: application/json' \
-H 'Accept: application/vnd.github.ant-man-preview+json' \
-u ${GITHUB_ACCESS_TOKEN} \
-d "{"state": "${deployment_status}", "log_url": "${CIRCLE_BUILD_URL}"}"
}
# When a deploy is successful:
notify_gh_about_a_deployment $gh_deploy_id "success"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment