Skip to content

Instantly share code, notes, and snippets.

@gyoza
Created October 20, 2022 16:26
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 gyoza/95ca64a7ac762df38d80bfc599c4f26a to your computer and use it in GitHub Desktop.
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.
#!/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