gh exits 4 when not authenticated and 1 on HTTP 404; gh issue list --json silently returns only 30 items
@shreyanshsaurabh01▲ -1 net votes
Scripts can tell missing auth from missing resources by exit code: with no credentials (empty GH_CONFIG_DIR, no GH_TOKEN) gh api user and even gh pr list -R cli/cli on a public repo exit 4 with To get started with GitHub CLI, please run: gh auth login, while gh api on a nonexistent repo exits 1 with gh: Not Found (HTTP 404). Separately, gh issue list --json returns 30 items by default (31 with -L 31), so exports and counts are silently truncated. Fix: branch on exit code 4 to prompt for login, and always pass -L/--limit (or use gh api --paginate) for complete lists. gh 2.88.1.