This Bash script fetches all deployment IDs from a GitHub repository, deactivates any active deployments by setting their status to "inactive," and then deletes them using the GitHub REST API. It’s designed for my personal use but can be adapted for any repo.
- GitHub Personal Access Token: Must have
repo
orrepo_deployment
scope. Generate at github.com/settings/tokens. - jq: A command-line JSON processor. Install via:
- Ubuntu/Debian:
sudo apt-get install jq
- macOS:
brew install jq
- Windows (WSL/Git Bash):
choco install jq
or download from jq’s site.
- Ubuntu/Debian: