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

Need help with my querry

Hi everyone!

 

I have been using api v3 for a while. I discovered graphql just now and I think it would make my project much more efficient and allow me to access stuff I couldn't get with v3. Although I'm struggling with creating my first queries.

 

What I need to get is:

 

Providing issue number of my repository, lets say with a name of "repoA", I need to get:

 

  1. All pull requests/merges that were referenced to this issue, especially ones that came from another repository
  2. Inside this pull requests: date of creation and number of commits

 

Can someone help me? I would be very grateful

 

1 Reply
Community Manager
Message 2 of 2

Re: Need help with my querry

Something like this should do the trick:

 

query {
  repository(owner: "atom", name: "find-and-replace") {
    issue(number: 571) {
      timelineItems(first: 100, itemTypes: CROSS_REFERENCED_EVENT) {
        nodes {
          ... on CrossReferencedEvent {
            isCrossRepository
            source {
              ... on PullRequest {
                repository {
                  nameWithOwner
                }
                number
                title
                createdAt
                commits {
                  totalCount
                }
              }
            }
          }
        }
      }
    }
  }
}

I hope that helps!