delete-gh-workflow-runs
delete-gh-workflow-runs copied to clipboard
Select/Deselect all items
I have 10k records, I want to delete everything at once. Yes, I can press fn + up and wait couple mins, then press tab and...
So will be great to have 'select all' button and something like filters (select old runs), etc.
Thank you
+1 even some extra cli option like --delete-all
Thank you for the suggestions.
I'm working on a new version of this script, which will be a much more fully featured proper piece of software.
All suggestions welcome!
I've created the below script just to clean up for now. Basically, it launches 10 requests for time.
#!/bin/bash
OWNER="myuser"
REPO="myrepo"
workflow_ids=($(gh api repos/$OWNER/$REPO/actions/workflows | jq '.workflows[] | .id'))
for workflow_id in "${workflow_ids[@]}"; do
echo "Listing runs for the workflow ID $workflow_id"
run_ids=( $(gh api repos/$OWNER/$REPO/actions/workflows/$workflow_id/runs --paginate | jq '.workflow_runs[].id') )
_id=0
_co=1
for run_id in "${run_ids[@]}"; do
echo "[$_id] Deleting Run ID $run_id ($_co of ${#run_ids[@]})"
(gh api repos/$OWNER/$REPO/actions/runs/$run_id -X DELETE >/dev/null) &
if [ $_id -eq 10 ]; then
echo "Waiting delete all 10..."
wait
_id=0
continue
fi
let "_id+=1"
let "_co+=1"
done
done