3

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?

Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159
Kilian
  • 2,122
  • 2
  • 24
  • 42

1 Answers1

4

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
        }
      }
    }
  } 
}
Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159