Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select/Deselect all items #6

Open
mmospanenko opened this issue Aug 14, 2023 · 3 comments
Open

Select/Deselect all items #6

mmospanenko opened this issue Aug 14, 2023 · 3 comments

Comments

@mmospanenko
Copy link

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

@jpereira
Copy link

+1 even some extra cli option like --delete-all

@jv-k
Copy link
Owner

jv-k commented Aug 21, 2023

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!

@jpereira
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants