Created
December 3, 2024 08:34
-
-
Save MudraR/85f6f342c63380908550785feae4ba9e to your computer and use it in GitHub Desktop.
[GitHub Enterprise Repos] Create GitHub Deployment Environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get team id: | |
| # https://docs.github.com/en/rest/teams/teams?apiVersion=2022-11-28#get-a-team-by-name | |
| # Create new deployment environment and protect it | |
| gh api \ | |
| --method PUT \ | |
| repos/ORG/REPO/environments/NEW_ENV \ | |
| -f "reviewers[][type]=Team" -F "reviewers[][id]=TEAMID" | |
| # Remove team from deployment environment | |
| gh api \ | |
| --method DELETE \ | |
| repos/ORG/REPO/environments/ENV_NAME/protection/reviewers/TEAMID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment