hledger/tools/ciwatch

13 lines
466 B
Plaintext
Raw Normal View History

2022-12-11 23:46:35 +03:00
#!/usr/bin/env bash
2022-12-12 04:31:40 +03:00
# ciwatch [INTERVALSECS] - watch the latest Github actions run until it completes, returning the exit status
2022-12-11 23:46:35 +03:00
INTERVAL="${1:-10}"
2022-12-12 04:31:40 +03:00
LATESTRUNNING=$(gh run list --json status,databaseId -q '.[] | select(.status | in({"in_progress":0,"queued":0,"requested":0,"waiting":0})).databaseId' | head -1)
2022-12-12 01:56:15 +03:00
if [[ -n $LATESTRUNNING ]]; then
gh run watch -i"$INTERVAL" "$LATESTRUNNING" --exit-status
else
echo "no runs in progress, attempting push"
fi