Last active
July 22, 2022 17:56
-
-
Save waseem/c71fa3c8b2b2824f2cdcb34bef51dcb3 to your computer and use it in GitHub Desktop.
Github GraphQL repo commit history for commits made before a certain commit.
This file contains hidden or 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
query { | |
repository(owner: "rails", name:"rails") { | |
ref(qualifiedName:"master") { | |
target { | |
... on Commit { | |
id | |
# | |
# We're are requesting commits in the multiple of 5. We can assume that the page size here is 5. | |
# Next page/cursor should use value in next multiples of 5s. So next page will have a | |
# after: "05eaa07627376626902bd7acde35406edf1bb2f2 5" | |
# And after that | |
# after: "05eaa07627376626902bd7acde35406edf1bb2f2 10" (5 * 2) | |
# It goes on like 5 * n where n = 0, 1, 2, 3... | |
# | |
# When results reach the point upto a commit which has already been processed, the reqsests should | |
# be stopped. | |
# | |
history(first:5 after: "05eaa07627376626902bd7acde35406edf1bb2f2 0") { | |
pageInfo{ | |
hasNextPage | |
startCursor | |
endCursor | |
} | |
edges { | |
node { | |
id | |
oid | |
message | |
author { | |
name | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!