Looking for a GraphQl query to search for a list of all commits when comparing between two branches on GitHub within a repository.
For example, https://github.com/account-test/repo-test/compare/main…development will render all the commits, if any.
How to get the list of all commits when comparing between two branches using the GitHub GraphQL API?
I tried query to get the Pull requests
{
repository(owner: "sample", name: "sample-test") {
refs(refPrefix: "refs/heads/", orderBy: {direction: DESC, field: TAG_COMMIT_DATE}, first: 100) {
edges {
node {
... on Ref {
name
target {
... on Commit {
history(first: 2) {
edges {
node {
... on Commit {
committedDate
}
}
}
}
}
}
}
}
}
}
}
}
However, comparing between two branches to get commits for a potential Pull Request is much more involved.