| name | github-graphql |
|---|---|
| version | 1.0.0 |
| author | pvoo |
| description | Query GitHub's GraphQL API v4 — search repos, inspect repositories, look up users/orgs, search issues/PRs, run arbitrary queries, and check rate limits. Use when you need richer GitHub data than REST provides. |
A collection of shell scripts for querying GitHub's GraphQL API v4 via the gh CLI. Search repos, inspect repositories, look up users/orgs, search issues/PRs, run arbitrary GraphQL queries, and monitor rate limits.
ghCLI — Install and authenticate:gh auth loginjq— JSON processor (usually pre-installed)
graphql.sh -q '{ viewer { login } }'
graphql.sh -q 'query($n: Int!) { viewer { repositories(first: $n) { nodes { name } } } }' --int-var n=5
graphql.sh -f queries/my_query.graphql --var org=githubsearch_repos.sh <query> [--language LANG] [--stars ">N"] [--topic TOPIC] [--limit N] [--sort stars|forks|updated] [--json]search_repos.sh "graphql client" --language typescript --stars ">100"
search_repos.sh "machine learning" --topic pytorch --limit 5 --jsonrepo_info.sh <owner/repo> [--json]repo_info.sh cli/cli
repo_info.sh microsoft/vscode --jsonShows: stars, forks, watchers, contributors, languages, topics, recent releases, license, open issues/PRs.
user_info.sh <username> [--json]user_info.sh torvalds
user_info.sh microsoft --jsonShows: bio, followers, repos, contributions, orgs (users) or members/teams (orgs), pinned repos.
org_repos.sh <org> [--sort stars|updated|pushed|name] [--limit N] [--language LANG] [--json]org_repos.sh github --limit 10
org_repos.sh microsoft --language python --sort stars --jsonsearch_issues.sh <query> [--type issue|pr|both] [--state open|closed|merged] [--repo owner/name] [--label LABEL] [--limit N] [--json]search_issues.sh "pagination bug" --repo graphql/graphql-js --type issue
search_issues.sh "breaking change" --type pr --state merged --limit 5rate_limit.sh [--json]All scripts support:
- Default — Human-friendly formatted output
--json— Structured JSON for programmatic use--help— Usage info with examples
| Variable | Purpose |
|---|---|
GH_TOKEN |
Alternative to gh auth login (optional) |
GH_HOST |
GitHub Enterprise host (optional) |
| Task | Script |
|---|---|
| Run any GraphQL query | graphql.sh |
| Find repos by keyword/topic/language | search_repos.sh |
| Get full details on a repo | repo_info.sh |
| Look up a user or org | user_info.sh |
| List an org's repositories | org_repos.sh |
| Find issues or PRs | search_issues.sh |
| Check rate limit before bulk work | rate_limit.sh |
references/graphql_patterns.md— Common query patterns, pagination, fragments, error handling- GitHub GraphQL Explorer
- GitHub GraphQL API Docs
- Scripts live in
scripts/and source_common.shfor shared helpers - Every script must support
--helpand--json - Test with
gh auth statusbefore submitting changes