user1902183
user1902183

Reputation: 3377

GitHub API: how to get total number of accessible repositories

What is the GitHub API endpoint that provides the info on the TOTAL number of repositories a user has access to?

I don't just mean repos that the user owns, or repos the user has as public, I mean ALL repos. Basically, the same list that user would see when browsing the repos on GitHub.com when logged in.

I know how to get a list of those, but that's limited to 100 at a time. Is there an API endpoint that would simply return the TOTAL number of them, without my having to retrieve all of them and count?

Upvotes: 5

Views: 2952

Answers (1)

VonC
VonC

Reputation: 1329092

Only the GraphQL API v4 would allow such a query with a "total number" request.

You can test queries in developer.github.com.

The query using repositories is only for repos accessible by a user, not for all GitHub repos. (RepositoryConnection)

query {
  viewer {
    repositories(isFork: false) {
      totalCount
    }
  }
}

But for all repositories, you would need to use Google BigQuery GitHub Data, which you can start exploring though dataset/bigquery-public-data:github_repos.

Upvotes: 5

Related Questions