Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Ground Controller Lvl 2
Message 1 of 2

GraphQL: List of branches and their first commit details

I'm tryting to get a repo's list of branches and their first commit details. I know that i need to do a git diff some how but i have no clue how to do so with GraphQL API. Any suggestion would be great.

1 Reply
Community Manager
Message 2 of 2

Re: GraphQL: List of branches and their first commit details

Hi @ariel1974,

 

Thank you for being here. Yes, there is a GraphQL API for that:

 

http://developer.github.com/v4/

 

You will see that the following objects have a userContentEdits connection which you can use to get the edit histories:

 

Issue.userContentEdits
Comment.userContentEdits
PullRequest.userContentEdits
CommitComment.userContentEdits
IssueComment.userContentEdits
PullRequestReviewComment.userContentEdits
PullRequestReview.userContentEdits
GistComment.userContentEdits

 

Here's an example for fetching the edits on this issue: https://github.com/integrations/jira/issues/247

{
  repository(owner: "integrations", name: "jira") {
    issue(number: 247) {
      userContentEdits(first: 100) {
        nodes {
          editedAt
          diff
        }
      }
    }
  }
}

 

You can run that in the GraphQL explorer to see the results:

https://developer.github.com/v4/explorer/

 

I hope this helps!


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!