Created
October 20, 2022 16:26
-
-
Save gyoza/95ca64a7ac762df38d80bfc599c4f26a to your computer and use it in GitHub Desktop.
delete all github workflow action runs.. Can require multiple runs if you have thousands of actions.
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
#!/bin/bash | |
OWNER=org | |
REPO=therepo | |
#GET DAT SHIZ | |
WORKFLOW_ID=$(gh workflow list|rev|cut -f 1|rev) | |
#DELETE DAT SHIZ | |
for i in ${WORKFLOW_ID[@]}; do | |
gh api -X GET /repos/$OWNER/$REPO/actions/workflows/$i/runs | jq '.workflow_runs[] | .id' | |
gh api -X GET /repos/$OWNER/$REPO/actions/workflows/$i/runs | jq '.workflow_runs[] | .id' | xargs -I{} gh api -X DELETE /repos/$OWNER/$REPO/actions/runs/{} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment