File: gh-trim-workflowruns

package info (click to toggle)
hxtools 20231224-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,640 kB
  • sloc: ansic: 4,825; perl: 3,463; sh: 1,629; cpp: 353; makefile: 149
file content (10 lines) | stat: -rwxr-xr-x 292 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
#!/bin/bash
if [ -z "$1" ]; then
	echo "Usage: $0 ghuser/ghrepo"
	exit 1
fi
gh api "repos/$1/actions/runs" --paginate -q '.workflow_runs[] | "\(.id)"' | \
tail -n +2 |
xargs -I% gh api "repos/$1/actions/runs/%" -X DELETE | \
cat
# needs cat to un-tty-ify stdout (else it tries to run $PAGER)