Skip to main content

rules

Overview

Namerules
TypeResource
Idgithub.repos.rules

Fields

NameDatatypeDescription
idintegerThe ID of the ruleset
namestringThe name of the ruleset
_linksobject
bypass_actorsarrayThe actors that can bypass the rules in this ruleset
conditionsobjectParameters for a repository ruleset ref name condition
created_atstring
current_user_can_bypassstringThe bypass type of the user making the API request for this ruleset. This field is only returned when
querying the repository-level endpoint.
enforcementstringThe 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).
node_idstring
rulesarray
sourcestringThe name of the source
source_typestringThe type of the source of the ruleset
targetstringThe target of the ruleset
updated_atstring

Methods

NameAccessible byRequired ParamsDescription
get_repo_rulesetSELECTowner, repo, ruleset_idGet a ruleset for a repository.
get_repo_rulesetsSELECTowner, repoGet all the rulesets for a repository.
create_repo_rulesetINSERTowner, repo, data__enforcement, data__nameCreate a ruleset for a repository.
delete_repo_rulesetDELETEowner, repo, ruleset_idDelete a ruleset for a repository.
get_branch_rulesEXECbranch, owner, repoReturns all active rules that apply to the specified branch. The branch does not need to exist; rules that would apply
to a branch with that name will be returned. All active rules that apply will be returned, regardless of the level
at which they are configured (e.g. repository or organization). Rules in rulesets with "evaluate" or "disabled"
enforcement statuses are not returned.
update_repo_rulesetEXECowner, repo, ruleset_idUpdate a ruleset for a repository.