Can we compare two branches with the Github GraphQL?
From their v3 rest API, you can do:
/repos/:owner/:repo/compare/:base...:head
(docs: https://developer.github.com/v3/repos/commits/#compare-two-commits)
and this works with SHA's, branches, tags, etc.
However, I'm unable to find it's equivalent GraphQL query in the docs.
This is my attempt so far :
I'm able to get the list of commits for each branch seperately, however, the entire history is loaded and I would only like the difference between canary branch and nightly branch.
query{
repository(owner:"samridh",name:"release-generator"){
name
branch0: ref(qualifiedName: "canary"){
target{
... on Commit {
history(first:100){
...CommitFragment
}
}
}
}
branch1: ref(qualifiedName: "nightly"){
target{
... on Commit {
history(first:100){
...CommitFragment
}
}
}
}
}
}
fragment CommitFragment on CommitHistoryConnection {
totalCount
nodes {
oid
message
committedDate
author {
name
email
}
}
pageInfo {
hasNextPage
endCursor
}
}
This would have been done as :
/repos/samridh/release-generator/compare/nightly...canary
in the v3 REST API