Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub GraphQL search limited to language

I'm trying to use GitHub's GraphQL API to find a list of repos matching a query but limited to a specific language. However I can't find anything in the docs relating to the language filter the typical online search supports or how something like this is typically done with GraphQL.

{
  search(query: "query", type: REPOSITORY, first: 10) {
    repositoryCount
    edges {
      node {
        ... on Repository {
          nameWithOwner
        }
      }
    }
  } 
}

I'm almost guessing this isn't quite possible and I'm going to have to query for everything and filter on the client instead?

like image 645
Kilian Avatar asked Mar 29 '26 20:03

Kilian


1 Answers

In the query parameter you can use the same format as Github search, filter language with language:LANGUAGE :

{
  search(query: "language:java", type: REPOSITORY, first: 10) {
    repositoryCount
    edges {
      node {
        ... on Repository {
          nameWithOwner
        }
      }
    }
  } 
}
like image 186
Bertrand Martel Avatar answered Apr 02 '26 03:04

Bertrand Martel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!