Created
August 4, 2013 14:25
-
-
Save gshutler/6150489 to your computer and use it in GitHub Desktop.
Tagging a commit with build status on GitHub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Examples | |
# | |
# $ gh-build-notification.sh pending "Build in progress" | |
# $ gh-build-notification.sh failure "Build failed" | |
# $ gh-build-notification.sh success "Build succeeded" | |
commit=`git rev-parse HEAD` | |
json="{\"state\":\"$1\",\"description\":\"$2\",\"target_url\":\"$BUILD_URL\"}" | |
echo "Sending notification to Github" | |
echo $json | |
# http://developer.github.com/v3/repos/statuses/#create-a-status | |
curl \ | |
-X POST \ | |
-H "Authorization: token API-TOKEN" \ | |
-H "User-Agent: Shell build notifier" \ | |
-d "$json" \ | |
--silent \ | |
--output /dev/null \ | |
https://api.github.com/repos/OWNER/REPO/statuses/$commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment