hledger/tools/ciwatch

15 lines
500 B
Plaintext
Raw Normal View History

2022-12-11 23:46:35 +03:00
#!/usr/bin/env bash
# ciwatch [INTERVALSECS]
# Watch the latest Github actions run until it completes, returning the exit status.
INTERVAL="${1:-10}"
#LATESTRUN=$(gh run list -L1 --json databaseId -q .[0].databaseId)
2022-12-12 01:56:15 +03:00
cilatestrunning() {
gh run list --json status,databaseId -q '.[] | select(.status | in({"in_progress":0,"queued":0,"requested":0,"waiting":0})).databaseId' | head -1
}
LATESTRUNNING=$(cilatestrunning)
gh run watch -i"$INTERVAL" ${LATESTRUNNING:+$LATESTRUNNING} --exit-status