Skip to content

Instantly share code, notes, and snippets.

@MudraR
Created December 3, 2024 08:34
Show Gist options
  • Select an option

  • Save MudraR/85f6f342c63380908550785feae4ba9e to your computer and use it in GitHub Desktop.

Select an option

Save MudraR/85f6f342c63380908550785feae4ba9e to your computer and use it in GitHub Desktop.
[GitHub Enterprise Repos] Create GitHub Deployment Environment
# 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