PUT
/orgs/{org}/rulesets/{ruleset_id}Replace an organization repository ruleset
Replaces an organization repository ruleset. Supply the ruleset properties you want to change, including target and enforcement where applicable; bypass_actors, conditions, and rules configure access and matching behavior. A 200 response returns the updated ruleset.
orgstringrequired
The organization name. The name is not case sensitive.
ruleset_idintegerrequired
The unique identifier of the ruleset to replace.
Organization ruleset properties to update. All listed fields are optional.
namestringoptional
The name of the ruleset.
targetstringoptional
The target of the ruleset
enforcementstringoptional
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).
bypass_actorsarray<RepositoryRulesetBypassActor>optional
The actors that can bypass the rules in this ruleset
conditionsobjectoptional
Conditions for an organization ruleset.
The branch and tag rulesets conditions object should contain both `repository_name` and `ref_name` properties, or both `repository_id` and `ref_name` properties, or both `repository_property` and `ref_name` properties.
The push rulesets conditions object does not require the `ref_name` property.
For repository policy rulesets, the conditions object should only contain the `repository_name`, the `repository_id`, or the `repository_property`.
rulesarray<RepositoryRule>optional
An array of rules within the ruleset.
200Returns the updated organization ruleset, including its identifier, name, target, enforcement level, bypass actors, conditions, and rules.
idintegerrequired
The ID of the ruleset
namestringrequired
The name of the ruleset
targetstringoptional
The target of the ruleset
source_typestringoptional
The type of the source of the ruleset
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).
bypass_actorsarray<RepositoryRulesetBypassActor>optional
The actors that can bypass the rules in this ruleset
current_user_can_bypassstringoptional
The bypass type of the user making the API request for this ruleset. This field is only returned when
querying the repository-level endpoint.
node_idstringoptional
_linksobjectoptional
conditionsobjectoptional
Parameters for a repository ruleset ref name condition
rulesarray<RepositoryRule>optional
created_atstringoptional
updated_atstringoptional
404Returned when the organization or ruleset cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint identifies the request as spam.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional
500Returned when an internal error occurs.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
Error handling
A 404 is returned when the org path parameter or ruleset_id path parameter does not identify an available organization ruleset. A 422 is returned when validation fails or the request is identified as spam; a 500 indicates an internal error. target must be branch, tag, push, or repository, and enforcement must be disabled, active, or evaluate; each bypass actor must include actor_type.