Skip to content

Instantly share code, notes, and snippets.

@pcheliniy
Last active May 15, 2022 09:28
Show Gist options
  • Save pcheliniy/7f89f2ea2dcf57f06a7124a232143a3e to your computer and use it in GitHub Desktop.
Save pcheliniy/7f89f2ea2dcf57f06a7124a232143a3e to your computer and use it in GitHub Desktop.
Remove dangling gh actions
myorg=pcheliniy
repo=chartrepo
### get wf ids, names, paths
gh api repos/${myorg}/${repo}/actions/workflows | jq -r '.workflows | .[] | .id, .name, .path, []'
wf_id=123456789
### remove runs history
gh api repos/${myorg}/${repo}/actions/workflows/${wf_id}/runs | jq -r '.workflow_runs | .[] | .id' | while read line; do
gh api repos/${myorg}/${repo}/actions/runs/$line -X DELETE;
done
### when you remove all previous runs of the job, removed jobs will disappeared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment