Open Context Protocol is live! 🚀 Read the launch post
reposGetAllDeploymentProtectionRules

reposGetAllDeploymentProtectionRules

Get all deployment protection rules for an environment

Details

  • Method: GET
  • Path: /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules
  • Operation ID: repos/get-all-deployment-protection-rules

Parameters

{
  "environment_name": {
    "description": "The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with `%2F`.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "repo": {
    "description": "The name of the repository without the `.git` extension. The name is not case sensitive.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "owner": {
    "description": "The account owner of the repository. The name is not case sensitive.",
    "required": true,
    "location": "path",
    "type": "string"
  }
}

Response Schema

{
  "type": "object",
  "properties": {
    "total_count": {
      "description": "The number of enabled custom deployment protection rules for this environment",
      "type": "integer",
      "example": 10
    },
    "custom_deployment_protection_rules": {
      "type": "array",
      "items": {
        "title": "Deployment protection rule",
        "description": "Deployment protection rule",
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 3515,
            "description": "The unique identifier for the deployment protection rule."
          },
          "node_id": {
            "type": "string",
            "example": "MDQ6R2F0ZTM1MTU=",
            "description": "The node ID for the deployment protection rule."
          },
          "enabled": {
            "type": "boolean",
            "example": true,
            "description": "Whether the deployment protection rule is enabled for the environment."
          },
          "app": {
            "title": "Custom deployment protection rule app",
            "description": "A GitHub App that is providing a custom deployment protection rule.",
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "example": 3515,
                "description": "The unique identifier of the deployment protection rule integration."
              },
              "slug": {
                "type": "string",
                "example": "my-custom-app",
                "description": "The slugified name of the deployment protection rule integration."
              },
              "integration_url": {
                "type": "string",
                "example": "https://api.github.com/apps/custom-app-slug",
                "description": "The URL for the endpoint to get details about the app."
              },
              "node_id": {
                "type": "string",
                "example": "MDQ6R2F0ZTM1MTU=",
                "description": "The node ID for the deployment protection rule integration."
              }
            },
            "required": [
              "id",
              "slug",
              "integration_url",
              "node_id"
            ]
          }
        },
        "required": [
          "id",
          "node_id",
          "enabled",
          "app"
        ]
      }
    }
  },
  "example": {
    "value": [
      {
        "total_count": 2
      },
      {
        "custom_deployment_protection_rules": [
          {
            "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"
            }
          },
          {
            "id": 4,
            "node_id": "MDE2OkRlcGxveW1lbnRTdHJ41128",
            "enabled": true,
            "app": {
              "id": 1,
              "node_id": "UHVE67RlcGxveW1lbnRTdTY!jfeuy",
              "slug": "another-custom-app",
              "integration_url": "https://api.github.com/apps/another-custom-app"
            }
          }
        ]
      }
    ]
  }
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('github')

# Call this tool
result = await agent.call_tool('reposGetAllDeploymentProtectionRules', {
    # Add required parameters here
})