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

reposCreateDeploymentProtectionRule

Create a custom deployment protection rule on an environment

Details

  • Method: POST
  • Path: /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules
  • Operation ID: repos/create-deployment-protection-rule

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"
  },
  "integration_id": {
    "description": "The ID of the custom app that will be enabled on the environment.",
    "required": false,
    "location": "body",
    "type": "integer"
  }
}

Response Schema

{
  "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"
  ]
}

Usage

from ocp_agent import OCPAgent

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

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