Skip to main content

protection_rules

Overview

Nameprotection_rules
TypeResource
Idgithub.repos.protection_rules

Fields

NameDatatypeDescription
idintegerThe unique identifier for the deployment protection rule.
appobjectA GitHub App that is providing a custom deployment protection rule.
enabledbooleanWhether the deployment protection rule is enabled for the environment.
node_idstringThe node ID for the deployment protection rule.

Methods

NameAccessible byRequired ParamsDescription
get_all_deployment_protection_rulesSELECTenvironment_name, owner, repoGets all custom deployment protection rules that are enabled for an environment. Anyone with read access to the repository can use this endpoint. If the repository is private and you want to use a personal access token (classic), you must use an access token with the repo scope. GitHub Apps and fine-grained personal access tokens must have the actions:read permission to use this endpoint. For more information about environments, see "Using environments for deployment."

For more information about the app that is providing this custom deployment rule, see the documentation for the GET /apps/{app_slug} endpoint.
get_custom_deployment_protection_ruleSELECTenvironment_name, owner, protection_rule_id, repoGets an enabled custom deployment protection rule for an environment. Anyone with read access to the repository can use this endpoint. If the repository is private and you want to use a personal access token (classic), you must use an access token with the repo scope. GitHub Apps and fine-grained personal access tokens must have the actions:read permission to use this endpoint. For more information about environments, see "Using environments for deployment."

For more information about the app that is providing this custom deployment rule, see GET /apps/{app_slug}.
create_deployment_protection_ruleINSERTenvironment_name, owner, repoEnable a custom deployment protection rule for an environment.

You must authenticate using an access token with the repo scope to use this endpoint. Enabling a custom protection rule requires admin or owner permissions to the repository. GitHub Apps must have the actions:write permission to use this endpoint.

For more information about the app that is providing this custom deployment rule, see the documentation for the GET /apps/{app_slug} endpoint.
disable_deployment_protection_ruleEXECenvironment_name, owner, protection_rule_id, repoDisables a custom deployment protection rule for an environment.

You must authenticate using an access token with the repo scope to use this endpoint. Removing a custom protection rule requires admin or owner permissions to the repository. GitHub Apps must have the actions:write permission to use this endpoint. For more information, see "Get an app".