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

Add status check contexts

Adds status check contexts to a protected branch in a repository. Supply the context names in contexts, either in an object or as a top-level array; the request body can be omitted. The branch name cannot contain wildcard characters.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

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 update. Cannot contain wildcard characters.

Status check contexts to add. Send either an object containing contexts or a top-level array of context names.

contextsarray<string>required
The name of the status checks

4 status codes
200Returns an array of status check context names for the branch.
403Returned when the authenticated user is not permitted to manage the branch protection settings.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the repository or branch cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 403 is returned when the authenticated user is not permitted to manage the branch protection settings. A 404 is returned when the repository or branch cannot be found. A 422 is returned when validation fails or the endpoint has been spammed. The branch path parameter cannot contain wildcard characters.