repos

Create a repository ruleset

Changed on

Create a ruleset for a repository.

post/repos/{owner}/{repo}/rulesets

Request

  • Base URL: https://api.github.com
  • URL: https://api.github.com/repos/{owner}/{repo}/rulesets
  • Auth: none declared

Path parameters

ownerstring required

The account owner of the repository. The name is not case sensitive.

repostring required

The name of the repository without the .git extension. The name is not case sensitive.

Request body

namestring required

The name of the ruleset.

target'branch' | 'tag' | 'push'

The target of the ruleset

enforcement'disabled' | 'active' | 'evaluate' required

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 not available for the repository target.

Response

Response

idinteger required

The ID of the ruleset

namestring required

The name of the ruleset

target'branch' | 'tag' | 'push' | 'repository'

The target of the ruleset

source_type'Repository' | 'Organization' | 'Enterprise'

The type of the source of the ruleset

sourcestring required

The name of the source

enforcement'disabled' | 'active' | 'evaluate' required

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 not available for the repository target.

current_user_can_bypass'always' | 'pull_requests_only' | 'never' | 'exempt'

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_idstring
created_atstring date-time
updated_atstring date-time

Changes

  • 2022-11-28a2954a79ff13Revision changes
    • breaking

      added to the / response property oneOf list for the response status

    • info

      added to the / request property oneOf list

  • 2022-11-280d4d57692126Revision changes
    • info

      added the new optional request property ////

    • info

      added the optional property //// to the response with the status