Created
March 24, 2023 05:28
-
-
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)
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
# 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