Skip to content

Instantly share code, notes, and snippets.

@eevmanu
Created March 21, 2023 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eevmanu/519fbf41d7218f74d4f1513a5c56f879 to your computer and use it in GitHub Desktop.
Save eevmanu/519fbf41d7218f74d4f1513a5c56f879 to your computer and use it in GitHub Desktop.
get commits count from github repo using graphql API
{
test1: repository(owner: "robfig", name: "cron") {
...RepoFragment
}
}
fragment RepoFragment on Repository {
name
defaultBranchRef {
name
target {
... on Commit {
id
history(first: 0) {
totalCount
}
}
}
}
}
{
"data": {
"test1": {
"name": "cron",
"defaultBranchRef": {
"name": "master",
"target": {
"id": "...",
"history": {
"totalCount": 147
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment