github
Scannednpx machina-cli add skill zebbern/icron/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)"'
Source
git clone https://github.com/zebbern/icron/blob/main/icron/skills/github/SKILL.mdView on GitHub Overview
Use the GitHub CLI (gh) to automate and retrieve data for issues, pull requests, CI runs, and advanced queries. This skill covers common gh commands and flags, including --repo for non-repo dirs and --json/--jq for structured outputs.
How This Skill Works
The gh tool exposes subcommands like gh issue, gh pr, gh run, and gh api to interact with GitHub data. Commands can target a repository with --repo owner/repo and output machine-readable data via --json and --jq for automation.
When to Use It
- Need to check the CI status of a PR and its checks
- Want to list recent GitHub Actions workflow runs for a repo
- Need to inspect a specific run's details or diagnose a failed step
- Require data from GitHub APIs not exposed by other commands
- Automate data extraction using structured JSON output via --json/--jq
Quick Start
- Step 1: Install GitHub CLI (gh) and ensure it is in your PATH
- Step 2: Run a sample command, e.g., gh pr checks 55 --repo owner/repo
- Step 3: Use gh api with --json/--jq for structured data
Best Practices
- Always specify --repo owner/repo when outside a git directory
- Use --json and --jq for reliable, parseable output
- Prefer gh run and gh pr checks for CI visibility in reviews
- Use gh api for custom fields and endpoints
- Keep identifiers (run IDs, PR numbers) ready for precise queries
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'