How can I get number of commits from Github API until certain branch


#1

I want to get how many commits has done until a certain branch created from the Github API.

For example in git cli I’m doing: git log --no-merges --oneline ${branchHash} | wc -l and I can see the number.

From the Github API there’s a limit of 100 so if I have more than 100 commits I can’t get them all.

Also tried:

{
  repository(name: "sickvim", owner: "jonathansick") {
    ref(qualifiedName: "master") {
      target {
        ... on Commit {
          id
          history(first: 1000) {
            pageInfo {
              hasNextPage
            }
            edges {
              node {
                messageHeadline
                oid
                message
                author {
                  name
                  email
                  date
                }
              }
            }
          }
        }
      }
    }
  }
}

But I’m getting:

{
  "data": null,
  "errors": [
    {
      "message": "Requesting 1000 records on the connection exceeds the `first` limit of 100 records."
    }
  ]
}

Is there any solution for that case?