GH Monitor
Monitor GitHub Actions runs and fix failures automatically.
Workflow
- Find the most recent run for the current branch:
gh run list --branch "$(git branch --show-current)" --limit 1 --json databaseId,status,conclusion,name,createdAt - Poll with
gh run view <id> --json status,conclusion,jobs,name,createdAt,updatedAt - Report concise status each poll:
[2m 30s] deploy — build (running), test (queued), deploy (queued) [5m 15s] deploy — All jobs completed (5m 15s) - On success — report final duration
- On failure — diagnose and fix (see below)
Polling
Every 10 seconds. After 10 minutes, slow to every 30 seconds. Use background task tools, not sleep loops.
Failure Handling
- Get logs:
gh run view <id> --log-failed - Diagnose root cause
- Fix code/config, commit, push
- Automatically monitor the new triggered run — don't ask, just do it
- Give up after 3 fix attempts — report status and ask the user