| name | gh-cli |
| description | GitHub CLI (gh) for debugging GitHub Actions and viewing releases. Use when working with: (1) GitHub Actions - view runs, check failures, download logs, re-run workflows, watch builds, (2) Releases - view, list, and download release assets. Supports JSON output for scripting and automation. |
GitHub CLI (gh) Skill
Focused guide to using GitHub CLI for debugging GitHub Actions and accessing release information.
Authentication
gh auth login
gh auth status
gh auth switch
GitHub Actions
Viewing Runs
gh run list
gh run list --limit 50
gh run list --status failure
gh run list --status success
gh run list --status in_progress
gh run list --workflow "CI"
gh run list --branch main
gh run list --json conclusion,name,databaseId,headBranch,createdAt,status,displayTitle
Viewing Run Details
gh run view <run-id>
gh run view <run-id> --web
gh run view <run-id> --log-failed
gh run view <run-id> --log
gh run view <run-id> --job <job-id>
Managing Runs
gh run cancel <run-id>
gh run rerun <run-id>
gh run rerun <run-id> --failed
gh run watch <run-id>
gh run download <run-id>
gh run download <run-id> --name artifact-name
Working with Workflows
gh workflow list
gh workflow view <workflow-name>
gh workflow enable <workflow-name>
gh workflow disable <workflow-name>
gh workflow run <workflow-name>
gh workflow run <workflow-name> --field key=value
Finding Failed Runs
gh run list --status failure --limit 3 --json conclusion,name,databaseId,headBranch,createdAt,displayTitle
gh run list --status failure --workflow "CI" --limit 10
gh run list --status failure --limit 1 | \
jq -r '.[0].databaseId' | \
xargs -I {} gh run view {} --log-failed
Pull Requests (Viewing Only)
gh pr list
gh pr list --author @me
gh pr view <pr-number>
gh pr view <pr-number> --web
gh pr checks <pr-number>
gh pr checkout <pr-number>
Releases
gh release list
gh release view <tag>
gh release view --latest
gh release download <tag>
gh release download <tag> --pattern "*.tar.gz"
gh release list --json tagName,name,createdAt,isLatest
Repository Operations
gh repo view
gh repo view --web
gh repo view owner/repo
gh repo clone owner/repo
JSON Output and Scripting
gh run list --json databaseId,conclusion,name,createdAt | \
jq '.[] | select(.conclusion == "failure")'
gh run list --limit 100 --json name,conclusion | \
jq 'group_by(.name) | map({name: .[0].name, failures: map(select(.conclusion == "failure")) | length})'
gh run list --json conclusion,name,createdAt | \
jq -r '.[] | "\(.createdAt)\t\(.conclusion)\t\(.name)"'
Investigating CI Failures Workflow
gh run list --status failure --limit 10
gh run view <run-id>
gh run view <run-id> --log-failed
gh run rerun <run-id> --failed
gh run watch <run-id>
Configuration
gh config list
export GH_REPO="owner/repo"
Environment Variables
GH_TOKEN - Authentication token
GH_REPO - Default repository (owner/repo)
GH_HOST - GitHub Enterprise host
GITHUB_TOKEN - Alternative to GH_TOKEN
Tips & Best Practices
- Use JSON output for automation: Add
--json field1,field2 for structured data
- Leverage jq for filtering: Pipe JSON output to jq for complex filtering
- Set defaults: Use
GH_REPO environment variable for frequently used repos
- Watch runs in real-time: Use
gh run watch to monitor CI/CD
- Filter early: Use built-in filters (
--status, --workflow, --branch) before piping to jq
- Download artifacts: Use
gh run download to get build artifacts for debugging
Getting Help
gh help
gh <command> --help