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.
Updating required status checks requires admin or owner permissions to the repository and branch protection to be enabled.
PATCH /repos/:owner/:repo/branches/:branch/protection/required_status_checks
The object passed can have the following keys:
| Name | Type | Description |
|---|---|---|
strict |
boolean |
Require branches to be up to date before merging. |
contexts |
array |
The list of status checks to require in order to merge into this branch |
{
"strict": true,
"contexts": [
"continuous-integration/travis-ci"
]
}
Status: 200 OK
{
"url": "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks",
"strict": true,
"contexts": [
"continuous-integration/travis-ci"
],
"contexts_url": "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts"
}