|
| 1 | +--- |
| 2 | +title: Statuses | GitHub API |
| 3 | +--- |
| 4 | + |
| 5 | +# Repo Statuses API |
| 6 | + |
| 7 | +The Status API allows external services to mark commits with a success, |
| 8 | +failure, error, or pending `state`, which is then reflected in pull requests |
| 9 | +involving those commits. |
| 10 | + |
| 11 | +Statuses can also include an optional `description` and `url`, and |
| 12 | +we highly recommend providing them as they make statuses much more |
| 13 | +useful in the GitHub UI. |
| 14 | + |
| 15 | +As an example, one common use is for continuous integration |
| 16 | +services to mark commits as passing or failing builds using Status. The |
| 17 | +`target_url` would be the full url to the build output, and the |
| 18 | +description would be the high level summary of what happened with the |
| 19 | +build. |
| 20 | + |
| 21 | +Note that the `repo:status` [OAuth scope](/v3/oauth/#scopes) grants targeted |
| 22 | +access to Statuses **without** also granting access to repo code, while the |
| 23 | +`repo` scope grants permission to code as well as statuses. |
| 24 | + |
| 25 | +## List Statuses for a specific SHA |
| 26 | + |
| 27 | + GET /repos/:user/:repo/statuses/:sha |
| 28 | + |
| 29 | +### Parameters |
| 30 | + |
| 31 | +sha |
| 32 | +: _Required_ **string** - Sha to list the statuses from |
| 33 | + |
| 34 | +### Response |
| 35 | + |
| 36 | +<%= headers 200 %> |
| 37 | +<%= json(:status) { |h| [h] } %> |
| 38 | + |
| 39 | +## Create a Status |
| 40 | + |
| 41 | + POST /repos/:user/:repo/statuses/:sha |
| 42 | + |
| 43 | +### Parameters |
| 44 | + |
| 45 | +state |
| 46 | +: _Required_ **string** State of the status - can be one of `pending`, |
| 47 | +`success`, `error`, or `failure`. |
| 48 | + |
| 49 | +target_url |
| 50 | +: _Optional_ **string** Target url to associate with this status. This |
| 51 | +URL will be linked from the GitHub UI to allow users to easily see the |
| 52 | +'source' of the Status. |
| 53 | + |
| 54 | +: For example, if your Continuous Integration system is posting build |
| 55 | +status, you would want to provide the deep link for the build output for |
| 56 | +this specific sha - `http://ci.example.com/johndoe/my-repo/builds/sha`. |
| 57 | + |
| 58 | +description |
| 59 | +: _Optional_ **string** Short description of the status |
| 60 | + |
| 61 | +### Response |
| 62 | + |
| 63 | +<%= headers 201, |
| 64 | + :Location => |
| 65 | +'https://api.github.com/repos/octocat/example/statuses/1' %> |
| 66 | +<%= json :status %> |
0 commit comments