Skip to content

Get a custom deployment protection rule

GET
/repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}

Gets an enabled custom deployment protection rule for an environment. Anyone with read access to the repository can 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}.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.

API method documentation

owner
required
string

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

repo
required
string

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

environment_name
required
string

The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.

protection_rule_id
required
integer

The unique identifier of the protection rule.

Response

Media type application/json
Deployment protection rule

Deployment protection rule

object
id
required

The unique identifier for the deployment protection rule.

integer
node_id
required

The node ID for the deployment protection rule.

string
enabled
required

Whether the deployment protection rule is enabled for the environment.

boolean
app
required
Custom deployment protection rule app

A GitHub App that is providing a custom deployment protection rule.

object
id
required

The unique identifier of the deployment protection rule integration.

integer
slug
required

The slugified name of the deployment protection rule integration.

string
integration_url
required

The URL for the endpoint to get details about the app.

string
node_id
required

The node ID for the deployment protection rule integration.

string
Examples
Example default
{
"id": 3,
"node_id": "IEH37kRlcGxveW1lbnRTdGF0ddiv",
"enabled": true,
"app": {
"id": 1,
"node_id": "GHT58kRlcGxveW1lbnRTdTY!bbcy",
"slug": "a-custom-app",
"integration_url": "https://api.github.com/apps/a-custom-app"
}
}