Created
April 1, 2023 13:12
-
-
Save thiskevinwang/ab2fae60383dabe90c758f35ca08389c to your computer and use it in GitHub Desktop.
Delete GitHub environments
This file contains 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
#!bin/sh | |
# This script fetches GitHub environments and delets them | |
# - requires the `gh` CLI | |
# - requires `jq` | |
envs=$(gh api repos/{owner}/{repo}/environments --paginate | jq -r ".environments[].name") | |
for env in $envs | |
do | |
echo "Deleting $env" | |
gh api repos/{owner}/{repo}/environments/$env -X DELETE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment