|
1 | 1 | --- |
2 | | -name: Set protection rules for an environment |
3 | | -example: octokit.repos.setEnvironmentProtectionRules({ owner, repo, environment_name, deployment_branch_policy.protected_branches, deployment_branch_policy.custom_branch_policies }) |
| 2 | +name: Create or update an environment |
| 3 | +example: octokit.repos.createOrUpdateEnvironment({ owner, repo, environment_name, deployment_branch_policy.protected_branches, deployment_branch_policy.custom_branch_policies }) |
4 | 4 | route: PUT /repos/{owner}/{repo}/environments/{environment_name} |
5 | 5 | scope: repos |
6 | 6 | type: API method |
7 | 7 | --- |
8 | 8 |
|
9 | | -# Set protection rules for an environment |
| 9 | +# Create or update an environment |
10 | 10 |
|
11 | | -Set protection rules, such as required reviewers, for an environment. For more information about environment protection rules, see "[Environments](/actions/reference/environments#environment-protection-rules)." |
| 11 | +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)." |
12 | 12 |
|
13 | 13 | **Note:** Although you can use this operation to specify that only branches that match specified name patterns can deploy to this environment, you must use the UI to set the name patterns. For more information, see "[Environments](/actions/reference/environments#deployment-branches)." |
14 | 14 |
|
| 15 | +**Note:** To create or update secrets for an environment, see "[Secrets](/rest/reference/actions#secrets)." |
| 16 | + |
15 | 17 | You must authenticate using an access token with the repo scope to use this endpoint. |
16 | 18 |
|
17 | 19 | ```js |
18 | | -octokit.repos.setEnvironmentProtectionRules({ |
| 20 | +octokit.repos.createOrUpdateEnvironment({ |
19 | 21 | owner, |
20 | 22 | repo, |
21 | 23 | environment_name, |
@@ -53,7 +55,7 @@ The amount of time to delay a job after the job is initially triggered. The time |
53 | 55 | </td></tr> |
54 | 56 | <tr><td>reviewers</td><td>no</td><td> |
55 | 57 |
|
56 | | -The people or teams that may 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. |
| 58 | +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. |
57 | 59 |
|
58 | 60 | </td></tr> |
59 | 61 | <tr><td>reviewers[].type</td><td>no</td><td> |
@@ -84,4 +86,4 @@ Whether only branches that match the specified name patterns can deploy to this |
84 | 86 | </tbody> |
85 | 87 | </table> |
86 | 88 |
|
87 | | -See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/repos#set-protection-rules-for-an-environment). |
| 89 | +See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/repos#create-or-update-an-environment). |
0 commit comments