Created
June 25, 2020 07:15
-
-
Save Sciss/ff9a2a30faf111dd9c0971b554d9b72c to your computer and use it in GitHub Desktop.
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/bash | |
# run this with personal-access-token (repo scope) as argument | |
# cf. https://stackoverflow.com/questions/53452910/how-to-remove-a-github-environment | |
env=github-pages | |
token=$1 | |
repo=Mellite | |
user=Sciss | |
if [ $# -eq 0 ] | |
then | |
echo "No access token supplied" | |
exit 1 | |
fi | |
for id in $(curl -u $user:$token https://api.github.com/repos/$user/$repo/deployments\?environment\=$env | jq ".[].id"); do | |
curl -X POST -u $user:$token -d '{"state":"inactive"}' -H 'accept: application/vnd.github.ant-man-preview+json' https://api.github.com/repos/$user/$repo/deployments/$id/statuses | |
curl -X DELETE -u $user:$token https://api.github.com/repos/$user/$repo/deployments/$id | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This requires that jq is installed:
sudo apt install jq