Skip to content

Instantly share code, notes, and snippets.

@peavers
Created March 24, 2021 16:45
Show Gist options
  • Save peavers/327c5bb985ef81ae718884299ee01bc0 to your computer and use it in GitHub Desktop.
Save peavers/327c5bb985ef81ae718884299ee01bc0 to your computer and use it in GitHub Desktop.
Bulk delete workflows from GitHub Actions
# Requires GitHub CLI installed and authenticated.
export USER=""
export REPO=""
export BRANCH="master"
gh api repos/$USER/$REPO/actions/runs | jq -r '.workflow_runs[] | select(.head_branch == "master") | "\(.id)"' | xargs -n1 -I % gh api repos/$USER/$REPO/actions/runs/% -X DELETE > out.log 2> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment