Created
July 22, 2016 16:20
-
-
Save colelawrence/b6d41d4fb93ecd17dd63341f00e6773b to your computer and use it in GitHub Desktop.
Create github API call with curl
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
| # DRONE_COMMIT commit sha | |
| # DRONE_BUILD_LINK | |
| # DRONE_REPO_OWNER repository owner | |
| # DRONE_REPO_NAME repository name | |
| # From github: | |
| # POST /repos/:owner/:repo/statuses/:sha | |
| export GITHUB_API=https://api.github.com | |
| export BODY=<< EOF | |
| { | |
| "state": "failure", # pending, error, or failure. | |
| "target_url": "https://example.com/build/status", | |
| "description": "The build failed!", | |
| "context": "test/test" | |
| } | |
| EOF | |
| curl -i \ | |
| -H "Accept: application/json" \ | |
| -H "Content-Type: application/json" \ | |
| -X POST -d "$BODY" \ | |
| "$GITHUB_API/repos/$DRONE_REPO_OWNER/$DRONE_REPO_NAME/statuses/$DRONE_COMMIT_SHA" | |
| # { | |
| # "state": "success", # pending, error, or failure. | |
| # "target_url": "https://example.com/build/status", | |
| # "description": "The build succeeded!", | |
| # "context": "continuous-integration/jenkins" | |
| # } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment