{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"Create or update an environment with protection rules, such as required reviewers. For more information about environment protection rules, see \"[Environments](/actions/reference/environments#environment-protection-rules).\"\n\n> [!NOTE]\n> To create or update name patterns that branches must match in order to deploy to this environment, see \"[Deployment branch policies](/rest/deployments/branch-policies).\"\n\n> [!NOTE]\n> To create or update secrets for an environment, see \"[GitHub Actions secrets](/rest/actions/secrets).\"\n\nOAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint.","properties":{"path":{"type":"object","properties":{"owner":{"type":"string","description":"The account owner of the repository. The name is not case sensitive."},"repo":{"type":"string","description":"The name of the repository without the `.git` extension. The name is not case sensitive."},"environment_name":{"type":"string","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":["owner","repo","environment_name"],"additionalProperties":false},"body":{"type":["object","null"],"properties":{"wait_timer":{"$ref":"#/definitions/wait-timer"},"prevent_self_review":{"$ref":"#/definitions/prevent-self-review"},"reviewers":{"type":["array","null"],"description":"The people or teams that may review jobs that reference the environment. You can list up to six users or teams as reviewers. The reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed.","items":{"type":"object","properties":{"type":{"$ref":"#/definitions/deployment-reviewer-type"},"id":{"type":"integer","description":"The id of the user or team who can review the deployment","examples":[4532992]}}}},"deployment_branch_policy":{"$ref":"#/definitions/deployment-branch-policy-settings"}},"additionalProperties":false,"examples":[{"wait_timer":30,"prevent_self_review":false,"reviewers":[{"type":"User","id":1},{"type":"Team","id":1}],"deployment_branch_policy":{"protected_branches":false,"custom_branch_policies":true}}]}},"required":["path"],"additionalProperties":false,"definitions":{"wait-timer":{"type":"integer","description":"The amount of time to delay a job after the job is initially triggered. The time (in minutes) must be an integer between 0 and 43,200 (30 days).","examples":[30]},"prevent-self-review":{"type":"boolean","description":"Whether or not a user who created the job is prevented from approving their own job.","examples":[false]},"deployment-reviewer-type":{"type":"string","description":"The type of reviewer.","enum":["User","Team"],"examples":["User"]},"deployment-branch-policy-settings":{"type":["object","null"],"description":"The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`.","properties":{"protected_branches":{"type":"boolean","description":"Whether only branches with branch protection rules can deploy to this environment. If `protected_branches` is `true`, `custom_branch_policies` must be `false`; if `protected_branches` is `false`, `custom_branch_policies` must be `true`."},"custom_branch_policies":{"type":"boolean","description":"Whether only branches that match the specified name patterns can deploy to this environment.  If `custom_branch_policies` is `true`, `protected_branches` must be `false`; if `custom_branch_policies` is `false`, `protected_branches` must be `true`."}},"required":["protected_branches","custom_branch_policies"]}}},"name":"Create or update an environment","id":"github.repos.create-or-update-environment","example":{"path":{"owner":"octocat","repo":"hello-world","environment_name":"example"}},"maxRequests":1,"summary":false}}