gh api graphql -f query='query($owner:String!,$repo:String!){ repository(owner:$owner,name:$repo){ stargazerCount } }' -f owner=cli -f repo=cli

Category: GitHub CLI

gh api graphql -f query='query($owner:String!,$repo:String!){ repository(owner:$owner,name:$repo){ stargazerCount } }' -f owner=cli -f repo=cli

Query stargazer count via GraphQL with variables

Runs a GraphQL query where every -f field except query becomes a GraphQL variable, here binding $owner and $repo. GraphQL lets you request exactly the fields you need in one round trip. Variables make queries reusable across repos.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.