Skip to content

Instantly share code, notes, and snippets.

@nesk
Last active October 26, 2022 09:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nesk/001c5185bbfdbd34f9a008fceb6f9b3f to your computer and use it in GitHub Desktop.
Save nesk/001c5185bbfdbd34f9a008fceb6f9b3f to your computer and use it in GitHub Desktop.
Delete the latest workflow runs of a repo (up to 100)

A fish oneliner to delete the latest workflow runs of a repo.

Install the GitHub CLI and replace <owner>/<repository> with your repository.

You can also change ?per_page=100 with the number of runs you want to delete.

begin; set -lx REPO <owner>/<repository>; gh api "/repos/$REPO/actions/runs?per_page=100" -q ".workflow_runs.[].id" | xargs -L1 -- bash -c "gh api --method DELETE /repos/$REPO/actions/runs/\$0"; end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment