GitHub Skill
Use the gh CLI to interact with GitHub. Always specify --repo owner/repo when not in a git directory, or use URLs directly.
Container Auth (Read First)
The gh CLI needs a one-time login per container. Follow this pattern:
gh auth loginis the ONLY interactive gh command. It shows an
arrow-key menu and waits for the user to paste a one-time code.
Your chat exec is non-interactive, so running gh auth login from
chat will hang forever. DO NOT attempt it from chat.
- Tell the user to run
gh auth loginin the dashboard Terminal
(Instance card → Terminal button) once — that's a real PTY where
the device-code flow works. After that single login, every other
gh command (gh repo create, gh repo clone, gh pr list, etc.)
is non-interactive and you can run them from chat normally.
- After the user finishes
gh auth loginin the Terminal, the
credential file ~/.config/gh/hosts.yml is written with a brief
delay. If your first gh auth status from chat returns "not
authenticated", wait 10–15 seconds and retry once. The state will
then be visible.
- If after retrying gh auth still fails (rare — usually means the
user's chat exec runs as a different user with a different HOME
from the Terminal), fall back to PAT-based git: ask the user for
a fine-grained PAT and use https://<pat>@github.com/... in clone
URLs. The PAT path is fully chat-driven and consistent.
Pull Requests
Check CI status on a PR:
gh pr checks 55 --repo owner/repo
List recent workflow runs:
gh run list --repo owner/repo --limit 10
View a run and see which steps failed:
gh run view <run-id> --repo owner/repo
View logs for failed steps only:
gh run view <run-id> --repo owner/repo --log-failed
API for Advanced Queries
The gh api command is useful for accessing data not available through other subcommands.
Get PR with specific fields:
gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
JSON Output
Most commands support --json for structured output. You can use --jq to filter:
gh issue list --repo owner/repo --json number,title --jq '.[] | "\(.number): \(.title)"'