REST API endpoints for commit statuses
Use the REST API to interact with commit statuses.
About commit statuses
You can use the REST API to allow external services to mark commits with an error, failure, pending, or success state, which is then reflected in pull requests involving those commits. Statuses can also include an optional description and target_url, and we highly recommend providing them as they make statuses much more useful in the GitHub UI.
As an example, one common use is for continuous integration services to mark commits as passing or failing builds using status. The target_url would be the full URL to the build output, and the description would be the high level summary of what happened with the build.
Statuses can include a context to indicate what service is providing that status. For example, you may have your continuous integration service push statuses with a context of ci, and a security audit tool push statuses with a context of security. You can then use the REST API to Get the combined status for a specific reference to retrieve the whole status for a commit.
Note that the repo:status OAuth scope grants targeted access to statuses without also granting access to repository code, while the repo scope grants permission to code as well as statuses.
If you are developing a GitHub App and want to provide more detailed information about an external service, you may want to use the REST API to manage checks. For more information, see REST API endpoints for checks.
Get the combined status for a specific reference
Users with pull access in a repository can access a combined view of commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name.
Additionally, a combined state is returned. The state is one of:
- failure if any of the contexts report as
errororfailure - pending if there are no statuses or a context is
pending - success if the latest status for all contexts is
success
Fine-grained access tokens for "Get the combined status for a specific reference"
This endpoint works with the following fine-grained token types:
- GitHub App user access tokens
- GitHub App installation access tokens
- Fine-grained personal access tokens
The fine-grained token must have the following permission set:
- "Commit statuses" repository permissions (read)
This endpoint can be used without authentication or the aforementioned permissions if only public resources are requested.
Parameters for "Get the combined status for a specific reference"
| Name, Type, Description |
|---|
accept string Setting to |
| Name, Type, Description |
|---|
owner |