Created
November 12, 2025 07:40
-
-
Save laGameTV/62e9107bac8a49032426043e00770ef0 to your computer and use it in GitHub Desktop.
Delete All GitHub Deployments for a Repo using gh-CLI & PowerShell
This file contains hidden or 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
| $ids = gh api --method GET -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" --paginate /repos/<user>/<repo>/deployments --jq '.[].id' | |
| $ids | ForEach-Object { | |
| gh api --method DELETE -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "/repos/<user>/<repo>/deployments/$_" | |
| Write-Host "deleted $_" | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to replace
<user>&<repo>