Skip to content

Instantly share code, notes, and snippets.

@fregante
Created March 24, 2023 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fregante/5b239118cd2aaf001b0d33d54166cd95 to your computer and use it in GitHub Desktop.
Save fregante/5b239118cd2aaf001b0d33d54166cd95 to your computer and use it in GitHub Desktop.
Delete all the workflow runs for a specific workflow in GitHub Actions (gh-cli)
# Install gh-cli https://cli.github.com
# cd to the repo folder
# Replace "ci.yml" with the workflow name you want to delete
# Run this to delete them all (500 runs at a time)
gh run list --json databaseId -q '.[].databaseId' -w ci.yml --limit 500 |
xargs -IID -P 15 gh api \
"repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/actions/runs/ID" \
-X DELETE
# Alternatively, run this to find the available workflows interactively:
gh workflow view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment