Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
github-graphql-commits-by-ref
query {
repository(owner: "pivotaltracker", name: "tracker") {
refs(refPrefix: "refs/heads/", first: 100) {
totalCount
pageInfo {
hasNextPage
}
edges {
node {
name
target {
... on Commit {
history(first: 5) {
edges {
node {
oid
messageHeadline
committedDate
# message
# author {
# name
# email
# date
}
}
}
}
}
}
}
}
}
}
query {
repository(owner: "pivotaltracker", name: "tracker") {
refs(refPrefix: "refs/heads/", first: 100) {
totalCount
pageInfo {
hasNextPage
endCursor
}
edges {
... refEdgeFrag
}
}
}
}
fragment refEdgeFrag on RefEdge {
node {
name
target {
... on Commit {
history(first: 1) {
edges {
node {
oid
messageHeadline
committedDate
url
author {
name
email
}
}
}
}
}
}
}
}
query {
repository(owner: "pivotaltracker", name: "tracker") {
r1: ref(qualifiedName: "master") {
name
},
r2: ref(qualifiedName: "94195378-super-admin-import") {
name
}
}
}
@drewwells
Copy link

drewwells commented Oct 12, 2021

have you found a way to reference a commit by sha?

@thewoolleyman
Copy link
Author

thewoolleyman commented Oct 14, 2021

This was 4 years ago, I don't remember much about it :)

I would suggest looking at the current github graphql API docs and playing around in the graphql explorer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment