Skip to content

Instantly share code, notes, and snippets.

@thewoolleyman
Last active October 14, 2021 07:21
Show Gist options
  • Save thewoolleyman/2294542455a8e673e0a844362e0b8bac to your computer and use it in GitHub Desktop.
Save thewoolleyman/2294542455a8e673e0a844362e0b8bac to your computer and use it in GitHub Desktop.
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

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

@thewoolleyman
Copy link
Author

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