Github
Verified@steipete
npx machina-cli add skill @steipete/github --openclawGitHub Skill
Use the gh CLI to interact with GitHub. Always specify --repo owner/repo when not in a git directory, or use URLs directly.
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)"'
Overview
Learn to interact with GitHub via the gh CLI. It covers issues, PRs, CI runs, and advanced data retrieval with gh api. Always specify --repo owner/repo when you're not in a git directory.
How This Skill Works
Run gh commands to access issues, PRs, and CI data: gh issue, gh pr, gh run, and gh api. Most commands support --json for structured output, and --jq to filter fields. Remember to supply --repo owner/repo when outside a git directory.
When to Use It
- Check CI status on a PR with gh pr checks <pr-number> --repo owner/repo
- List recent workflow runs with gh run list --repo owner/repo --limit 10
- View a specific run and identify failed steps with gh run view <run-id> --repo owner/repo
- Fetch PR or issue data not exposed by other commands using gh api (e.g., gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login')
- Query and present issues/PRs in a structured format using gh issue/pr with --json and --jq
Quick Start
- Step 1: Ensure the gh CLI is installed and you can run gh commands.
- Step 2: Always include --repo owner/repo when you are not in a git directory.
- Step 3: Try a common query like gh pr checks 55 --repo owner/repo to verify CI status.
Best Practices
- Always specify --repo owner/repo when you are not inside a git directory
- Use --json and --jq to get structured output and easy parsing
- Use gh run view <id> --log-failed to fetch logs of failed steps
- Prefer gh pr checks to quickly verify CI status on a PR
- Use gh api for data not exposed by standard subcommands
Example Use Cases
- gh pr checks 55 --repo owner/repo
- gh run list --repo owner/repo --limit 10
- gh run view <run-id> --repo owner/repo
- gh run view <run-id> --repo owner/repo --log-failed
- gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'