Skip to content

Instantly share code, notes, and snippets.

@fijimunkii
Created February 14, 2023 19:20
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 fijimunkii/d62d5989bee76aa6078f84dd7c0851ae to your computer and use it in GitHub Desktop.
Save fijimunkii/d62d5989bee76aa6078f84dd7c0851ae to your computer and use it in GitHub Desktop.
delete github actions runs for disabled workflows
#!/bin/sh
# delete github actions runs for disabled workflows
repo="$1"
for workflow_id in $(gh api /repos/$repo/actions/workflows | jq -r '.workflows[] | select(.state == "disabled_manually") | .id'); do
for run_id in $(gh api /repos/$repo/actions/workflows/$workflow_id/runs | jq -r '.workflow_runs[].id'); do
gh api /repos/$repo/actions/runs/$run_id -X DELETE
sleep 1 # to avoid rate limit
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment