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

Add status check contexts

Adds status check contexts to the required status checks 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 configured 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.

Status check contexts to add, 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

4 status codes
200Returns an array of the configured status check context names.
403Returned when access to the protected branch is forbidden.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
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 403 is returned when access to the protected branch is forbidden. 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.