| name | use-gh-cli |
| description | Use `gh` CLI for GitHub operations (CI logs, PRs, issues, releases) instead of HTTP web fetch. GitHub API requires authentication; `web_fetch` returns limited/empty data. The `gh` CLI is pre-authenticated and available in the sandbox. |
Use gh CLI for GitHub
Problem
web_fetch / HTTP GET to github.com or api.github.com returns empty or limited data — GitHub requires authentication for most API endpoints and even web pages. This means CI logs, PR diffs, issue details, and release assets all fail via plain web fetch.
The gh CLI is on PATH inside the sandbox, but only pixi run pi -- --with-git (note the --) binds auth credentials. Unsandboxed (pi-unsafe) works too.
First: Check Auth, Stop If Missing
Before any gh command, run gh auth status. If it fails, stop immediately — no workarounds. Tell user:
gh CLI is not authenticated. Restart pi with pixi run pi <path-to-workspace> -- --with-git to bind GitHub auth credentials. Re-run with --with-git and try again.
Do not fall back to web_fetch or other methods.
Use gh Instead
CI Logs (most common failure)
When user pastes a CI log URL — do NOT use web_fetch. Extract owner/repo, run ID, and optional job ID from the URL, then use gh:
| URL | Pattern | gh command |
|---|
https://github.com/owner/repo/actions/runs/12345 | run ID = 12345 | gh run view 12345 --log |
https://github.com/owner/repo/actions/runs/12345/job/67890 | run ID = 12345, job ID = 67890 | gh run view 12345 --log --job 67890 |
Example: user pastes https://github.com/dask/dask/actions/runs/27794025788/job/82249639708
→ gh run view 27794025788 --log --job 82249639708
For a run-only URL: https://github.com/dask/dask/actions/runs/27794025788
→ gh run view 27794025788 --log
gh run list --limit 10
gh run list --limit 5 --status failure
gh run view <run-id> --log
gh run view <run-id> --log --job <job-id>
gh run view <run-id> --log > ci.log
PRs and Issues
gh pr view <number>
gh pr view <number> --json
gh issue view <number>
gh pr list --state open
Releases
gh release view <tag>
gh release list --limit 5
Repo Info
gh repo view
gh repo view --json defaultBranch,description,homepageUrl
Notes
gh works in the current directory's repo context. Outside a repo, use gh <command> --repo <owner>/<repo>.
- Pipeline:
gh run list --json databaseId --jq '.[0].databaseId' to extract IDs for scripting.
- For long outputs, redirect to file and read with
read tool.