Skip to content

Instantly share code, notes, and snippets.

@pcreux
Created February 18, 2013 10:20
Show Gist options
  • Star 27 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save pcreux/4976429 to your computer and use it in GitHub Desktop.
Save pcreux/4976429 to your computer and use it in GitHub Desktop.
Github Commit Status API with Bamboo from Atlassian. Add those to your plan as Script.
# specs and cukes results are stored in JUnit format under test-reports
if (grep 'failures="[^0]"' test-reports/* || grep 'errors="[^0]"' test-reports/*); then
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "failure", "description": "Failed!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
else
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "success", "description": "Success!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
fi
curl -H "Authorization: token MY_TOKEN" --request POST --data '{"state": "pending", "description": "Build is running", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
@brodrigu
Copy link

thanks!

@Trass3r
Copy link

Trass3r commented Feb 25, 2016

For windows builds use Script without powershell option and

curl --data "{\"state\": \"pending\", \"description\": \"Build is running\", \"target_url\": \"${bamboo.buildResultsUrl}\"}" https://api.github.com/repos/OWNER/REPO/statuses/${bamboo.planRepository.revision} -H "Authorization: token TOKEN"```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment