Searching for repositories by topic using the GitHub GraphQL API
This post is over three years old. Some of it may no longer reflect current tooling or my current view.
I wanted to use the GitHub GraphQL API to return all of the repositories on the https://github.com/topics/git-scraping page.
At first glance there isn’t a GraphQL field for that page - but it turns out you can access it using a GitHub search:
topic:git-scraping sort:updated-desc
An oddity of GitHub search is that sort order can be defined using tokens that form part of the search query!
Here’s a GraphQL query tested here that returns the most recent 100 git-scraping tagged repos, sorted by most recently updated.
{
search(query: "topic:git-scraping sort:updated-desc", type: REPOSITORY, first: 100) {
repositoryCount
nodes {
... on Repository {
nameWithOwner
description
updatedAt
createdAt
diskUsage
}
}
}
}