Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github GraphQL Repository Query, commits totalCount

How to search for Github Repositories using GraphQL, and get its total commits count as well in return?

It looks strange to me that all fields available describing Repositories contains total count of commit comments but not total count of commits.

like image 684
xpt Avatar asked Jul 14 '26 05:07

xpt


1 Answers

Here's an example of how to get the total number of commits for the master branch in the rails/rails repository:

query {
  repository(owner:"rails", name:"rails") {
    object(expression:"master") {
      ... on Commit {
        history {
          totalCount
        }
      }
    }
  }
}
like image 123
bswinnerton Avatar answered Jul 18 '26 09:07

bswinnerton



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!