POST /orgs/{org}/rulesets

Create a repository ruleset for an organization.

Servers

Path parameters

Name Type Required Description
org String Yes

The organization name. The name is not case sensitive.

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
rules[] Array No

An array of rules within the ruleset.

name String Yes

The name of the ruleset.

target String No

The target of the ruleset

Possible values:

  • "branch"
  • "push"
  • "repository"
  • "tag"

Default value: "branch"

conditions Object No

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.

bypass_actors[] Array No

The actors that can bypass the rules in this ruleset

bypass_actors[].bypass_mode String No

When the specified actor can bypass the ruleset. pull_request means that an actor can only bypass rules on pull requests. pull_request is not applicable for the DeployKey actor type. Also, pull_request is only applicable to branch rulesets.

Possible values:

  • "pull_request"
  • "always"

Default value: "always"

bypass_actors[].actor_id Integer No

The ID of the actor that can bypass a ruleset. If actor_type is OrganizationAdmin, this should be 1. If actor_type is DeployKey, this should be null. OrganizationAdmin is not applicable for personal repositories.

bypass_actors[].actor_type String Yes

The type of actor that can bypass a ruleset.

Possible values:

  • "Team"
  • "DeployKey"
  • "Integration"
  • "OrganizationAdmin"
  • "RepositoryRole"
enforcement String Yes

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).

Possible values:

  • "active"
  • "disabled"
  • "evaluate"

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.