Last active
January 20, 2024 07:58
-
-
Save jonathansick/8bbe88a85addaeeea4e7fe9ef15b016b to your computer and use it in GitHub Desktop.
GitHub GraphQL repo commit history query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
repository(name: "sickvim", owner: "jonathansick") { | |
ref(qualifiedName: "master") { | |
target { | |
... on Commit { | |
id | |
history(first: 5) { | |
pageInfo { | |
hasNextPage | |
} | |
edges { | |
node { | |
messageHeadline | |
oid | |
message | |
author { | |
name | |
date | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This was the first Google result my search, can you update the code to use
defaultBranchRef
instead ofref(…)
?
If you do, please at least comment with the original version (or maybe make another file in the gist?) because this query is also useful to figure out how to get history from a certain point (be that tag or commit oid).
I let this here maybe it helps somebody else to get commits for defaultBranchRef:
{
repository(owner: "sulu", name: "sulu") {
defaultBranchRef {
name
target {
... on Commit {
history {
totalCount
}
}
}
}
stargazers {
totalCount
}
releases {
totalCount
}
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was the first Google result my search, can you update the code to use
defaultBranchRef
instead ofref(…)
?