Skip to content

Instantly share code, notes, and snippets.

@sharat
Last active August 11, 2023 06:33
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 sharat/9edf293950e4785663e58aecbdac9b95 to your computer and use it in GitHub Desktop.
Save sharat/9edf293950e4785663e58aecbdac9b95 to your computer and use it in GitHub Desktop.
Delete GitHub Workflow Runs based on status using GitHub CLI
# Filters the runs based on the status such as failure, cancelled etc.,
# Filter its `databaseId` with JSON fields, extract the value using `jq` then pipe it to delete
gh run list --status=failure --json databaseId --jq '.[] | .databaseId' | xargs -I {} gh run delete {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment