Skip to content

Instantly share code, notes, and snippets.

@L480
Created August 16, 2024 12:20
Show Gist options
  • Save L480/bda5cc2bd8267c7c4cced76b2e581497 to your computer and use it in GitHub Desktop.
Save L480/bda5cc2bd8267c7c4cced76b2e581497 to your computer and use it in GitHub Desktop.
GitHub Deployment Cleanup
#!/bin/bash
ENV=$1
for ID in $(gh api -X GET /repos/L480/repo/deployments?environment=${ENV// /%20} | jq -r ".[] | .id")
do
echo "Deleting deployment $ID"
gh api -X DELETE /repos/L480/repo/deployments/$ID | jq '.'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment