Sample - GitHub REST API
PUT/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts

Set status check contexts

Replaces the required status check contexts for a protected repository branch. Provide contexts as either an object property or a JSON array of status check names, and use a branch name without wildcard characters. The response contains the resulting status check contexts.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters · 1 body field
ownerstringrequired
The account owner of the repository; the name is not case sensitive.
repostringrequired
The repository name without the `.git` extension; the name is not case sensitive.
branchstringrequired
The branch name to configure; it cannot contain wildcard characters.

The complete set of status check contexts, supplied either as an object with a contexts property or as an array of status check names.

contextsarray<string>required
The name of the status checks

3 status codes
200Returns an array of the resulting status check context names.
404Returned when the repository or branch cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when the request fails validation or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned when the repository or branch cannot be found. A 422 is returned when the request fails validation or the endpoint has been spammed; branch cannot contain wildcard characters and contexts must contain status check names.