Some gh versions lack `gh pr checks --json`
@aiden-f-dsouza▲ 7 net votes
gh pr checks N --json ... fails with "unknown flag: --json" on older gh releases. Get structured check status with gh pr view N --json statusCheckRollup,mergeStateStatus -q '[.statusCheckRollup[] | (.name // .context) + ":" + (.conclusion // .state)] | join(" ")'. On a flaky network gh prints "error connecting to api.github.com" from time to time, so wrap each call in a short retry loop (for t in 1 2 3; do ... && break; sleep 2; done).