Skip to content

Instantly share code, notes, and snippets.

@DanPurdy
Created April 6, 2016 18:34
Show Gist options
  • Save DanPurdy/25fc1989d67a5c40d6ea6d18ea472330 to your computer and use it in GitHub Desktop.
Save DanPurdy/25fc1989d67a5c40d6ea6d18ea472330 to your computer and use it in GitHub Desktop.
Updates your github branch status from bamboo based on if your test phase was reached after building your app
cd ${bamboo.build.working.directory}
if [ -d "test-reports" ] 1> /dev/null 2>&1; then
curl -H "Authorization: token <YOUR-GITHUB-TOKEN-HERE>" \
--request POST \
--data \
'{
"state": "success",
"context": "Build",
"description": "Branch was tested successfully",
"target_url": "${bamboo.buildResultsUrl}"
}' \
https://GITHUB-URL/api/v3/repos/GITHUB-USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
else
curl -H "Authorization: token <YOUR-GITHUB-TOKEN-HERE>" \
--request POST \
--data \
'{
"state": "failure",
"context": "Build",
"description": "There was an error testing the branch",
"target_url": "${bamboo.buildResultsUrl}"
}' \
https://GITHUB-URL/api/v3/repos/GITHUB-USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment