PUT /repos/{owner}/{repo}/environments/{environment_name}
Create or update an environment with protection rules, such as required reviewers. For more information about environment protection rules, see "Environments."
[!NOTE] To create or update name patterns that branches must match in order to deploy to this environment, see "Deployment branch policies."
[!NOTE] To create or update secrets for an environment, see "GitHub Actions secrets."
OAuth app tokens and personal access tokens (classic) need the repo
scope to use this endpoint.
Servers
- https://api.github.com
Path parameters
Name | Type | Required | Description |
---|---|---|---|
repo |
String | Yes |
The name of the repository without the |
environment_name |
String | Yes |
The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with |
owner |
String | Yes |
The account owner of the repository. The name is not case sensitive. |
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
wait_timer |
Integer | No |
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). |
reviewers[] |
Array | No |
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. |
reviewers[].id |
Integer | No |
The id of the user or team who can review the deployment |
reviewers[].type |
String | No |
The type of reviewer. Possible values:
|
deployment_branch_policy |
Object | No |
The type of deployment branch policy for this environment. To allow all branches to deploy, set to |
deployment_branch_policy.custom_branch_policies |
Boolean | Yes |
Whether only branches that match the specified name patterns can deploy to this environment. If |
deployment_branch_policy.protected_branches |
Boolean | Yes |
Whether only branches with branch protection rules can deploy to this environment. If |
prevent_self_review |
Boolean | No |
Whether or not a user who created the job is prevented from approving their own job. |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.