# Login (use pat_repos_packages.txt as token)
% gh auth login

# List all workflows ids:
gh api "/repos/mattereppe/otupy/actions/runs" --jq '.workflow_runs[].id'

# List all workflows names:
% gh api "/repos/mattereppe/otupy/actions/runs" --jq '.workflow_runs[].name'

# Select workflows by name (full list of ids):
% gh api "/repos/mattereppe/otupy/actions/runs" --jq '.workflow_runs[] | select(.name == "Test repository dispatch") | .id '

# Select workflow by name and commit message (can be used to exclude the latest run):
% gh api "/repos/mattereppe/otupy/actions/runs" --jq '.workflow_runs[] | select(.name == "Test repository dispatch") | select(.head_commit.message == "Fixed pypi workflow for testing") | .id '

# Save ids to a file, then run:
% while read id; do gh api -X DELETE "repos/mattereppe/otupy/actions/runs/$id" > /dev/null; done < delete.txt
