POST
/repos/{owner}/{repo}/actions/policiesCreate a repository Actions policy
Create an Actions policy for a repository.
Omitting workflow_path targets all workflows without storing an explicit condition.
- IdempotentThe SDK sends
Idempotency-Key, so a retried request is only applied once.
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
namestringrequired
The name of the policy.
enforcementstringrequired
The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).
conditionsobjectoptional
Conditions for a repository Actions policy. The object may be empty to preserve or use the
default workflow targeting, or contain only `workflow_path`.
rulesarray<ActionsRule>optional
An array of rules within the policy.
201Response
idintegerrequired
The ID of the policy
namestringrequired
The name of the policy
targetstringrequired
The target of the policy
source_typestringrequired
The type of the source of the policy
sourcestringrequired
The name of the source
enforcementstringrequired
The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).
conditionsobjectoptional
When workflow path targeting is available, detailed responses represent an omitted stored
workflow condition as `workflow_path` with `include` set to `["~ALL"]` and `exclude` set to `[]`.
When workflow path targeting is unavailable, an omitted stored condition remains omitted.
rulesarray<ActionsRule>optional
An array of rules within the policy
node_idstringoptional
_linksobjectoptional
created_atstringoptional
updated_atstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional
500Internal Error
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
Error handling
A 404 is returned: Resource not found. A 422 is returned: Validation failed, or the endpoint has been spammed. A 500 is returned: Internal Error.