Unable to get commits between tags




I am trying to fetch the diff of two release tags by comparing them and then fetching all the commits between them using the GitHub GraphQL API.

I am currently using the following query:

query GetCommitsBetweenTags {
    repository(owner: "var1", name: "var2") {
	    commitComments(after: "var3", before: "var4", first: 10) {
		    edges {
			    node {
				    commit {

Where each varX is replaced with the appropriate value, and var3 and var4 are my release tags. When I run the query I am told that the tag I am using in var3 is an invalid cursor argument…

Have I got this all wrong? The equivalent REST API v3 call would be something like: /api/v3/repos/var1/var2/compare/var3…var4


Hi @bluey31!

Looking at your example, the before and after parameters are GraphQL pagination cursors, not tags. For more information on GraphQL pagination you can check out these docs https://graphql.org/learn/pagination/.

To address your issue - we do not currently have a GraphQL API that allows for getting the commits between two tags. We’ve filed an internal schema request for this and we will update here.


Hi @rlinehan, thanks for the reply. I’ll keep an eye on this thread looking out for when that change has been merged!