eiu165
eiu165

Reputation: 6271

using graphql github api to get commit information by Id

I would like to get commit details for a specific commit given that I already have the commit id

for example, if I know the commit id is 12762b76cba8ac4623a6c16e1fe60efafa3b7d1c and the repo is ruby/ruby

how do I get the committedDate and author email?

Upvotes: 1

Views: 970

Answers (1)

VonC
VonC

Reputation: 1328332

You can try using a cursor as an edge type, as in this thread:

{
  repository(owner: "octocat", name: "Hello-World") {
    first: object(expression: "master") {
      ... on Commit {
        history(path: "README", last: 1, before: "762941318ee16e59dabbacb1b4049eec22f0d303 1") {
          edges {
            node { 
              committedDate 
              oid
              author
              {  
                email
              }
            } 
          }
        }
      }
    }
  }
}

you can test it using this explorer https://developer.github.com/v4/explorer/

Upvotes: 1

Related Questions