1

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?

eiu165
  • 6,101
  • 10
  • 41
  • 59

1 Answers1

1

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/

eiu165
  • 6,101
  • 10
  • 41
  • 59
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • this works as long as you don't need the last commit. if you go to https://developer.github.com/v4/explorer/ and you use 7fd1a60b01f91b314f59955a4e4d4e80d8edf11d it will give you the 76294 commit. This happens because we are using the cursor to get the commit after 7fd1. – eiu165 Jul 29 '19 at 14:47
  • @eiu165 Can you edit this answer with the actual query you ended up using? – VonC Jul 29 '19 at 15:22
  • @eiu165 Thank you so much. Apparently, you did not use the "cursor" edge type. – VonC Jul 29 '19 at 16:05