Skip to content

Set status check contexts

PUT
/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub’s products in the GitHub Help documentation.

API method documentation

owner
required
string

The account owner of the repository. The name is not case sensitive.

repo
required
string

The name of the repository without the .git extension. The name is not case sensitive.

branch
required
string

The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.

Media typeapplication/json
One of:
object
contexts
required

The name of the status checks

Array<string>
Examples
Exampledefault

Example updating status checks for a branch protection rule

{
"contexts": [
"continuous-integration/travis-ci"
]
}

Response

Media typeapplication/json
Array<string>
Examples
Exampledefault
[
"continuous-integration/travis-ci"
]

Resource not found

Media typeapplication/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Examplegenerated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Validation failed, or the endpoint has been spammed.

Media typeapplication/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Examplegenerated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}