Last active
August 29, 2022 06:41
-
-
Save ka2n/d462d3c1ef0a234b80289ac23ee5a39a to your computer and use it in GitHub Desktop.
Delete some environments from GitHub
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
owner= | |
repo= | |
gh api repos/{owner}/{repo}/environments\?per_page=100 | | |
jq '.environments[] | select(.name | (contains("production") or contains("preview")) | not) | .node_id' | | |
xargs -n1 -I% sh -c " | |
gh api graphql -F query=' | |
mutation { | |
deleteEnvironment(input: { id: \"%\"}) { | |
clientMutationId | |
} | |
} | |
' | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment