Skip to content

Instantly share code, notes, and snippets.

@laGameTV
Created November 12, 2025 07:40
Show Gist options
  • Select an option

  • Save laGameTV/62e9107bac8a49032426043e00770ef0 to your computer and use it in GitHub Desktop.

Select an option

Save laGameTV/62e9107bac8a49032426043e00770ef0 to your computer and use it in GitHub Desktop.
Delete All GitHub Deployments for a Repo using gh-CLI & PowerShell
$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 $_"
}
@laGameTV
Copy link
Author

Make sure to replace <user> & <repo>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment