File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # script/gh_auth_check
3+ # Verifies that the GitHub CLI (gh) is installed and authenticated.
4+ # Exits non-zero with actionable guidance if either check fails.
5+
6+ set -euo pipefail
7+
8+ # ── 1. Check gh is installed ──────────────────────────────────────────────────
9+ if ! command -v gh & > /dev/null; then
10+ echo " ERROR: gh CLI is not installed." >&2
11+ echo " " >&2
12+ echo " Install it with one of the following:" >&2
13+ echo " macOS: brew install gh" >&2
14+ echo " Linux: https://github.com/cli/cli/blob/trunk/docs/install_linux.md" >&2
15+ echo " Windows: https://github.com/cli/cli#windows" >&2
16+ exit 1
17+ fi
18+
19+ # ── 2. Check gh is authenticated ─────────────────────────────────────────────
20+ if ! gh auth status & > /dev/null; then
21+ echo " ERROR: gh CLI is not authenticated." >&2
22+ echo " " >&2
23+ echo " Run the following to log in:" >&2
24+ echo " gh auth login" >&2
25+ echo " " >&2
26+ echo " Then re-run this check:" >&2
27+ echo " ./script/gh_auth_check" >&2
28+ exit 1
29+ fi
30+
31+ echo " gh CLI is installed and authenticated."
You can’t perform that action at this time.
0 commit comments