Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Pilot Lvl 1
Message 1 of 3

Sort pull requests by `mergedAt` property (graphql, v4 API)

 

In the following I'm getting 10 merged pull requests sorted by when they were last updated. 

 

query getPulLRequestBySearchQuery {
  search(query: "repo:elastic/kibana type:pr is:merged sort:updated-desc", type: ISSUE, first: 10) {
    nodes {
      ... on PullRequest {
        number
        mergedAt
        updatedAt
      }
    }
  }
}

 

 

I'd like to get the 10 most recently merged pull requests. Is this possible? 

2 Replies
Highlighted
Copilot Lvl 3
Message 2 of 3

Re: Sort pull requests by `mergedAt` property (graphql, v4 API)

I asked the same question some time ago: GraphQL - Get merged PullRequests in mergedAt order 

Unfortunetely no answer was given.

 

What a I do for now as a workaround is calling

git log

on the command line, and parsing that output, which is in the mergedAt order.

Highlighted
Ground Controller Lvl 1
Message 3 of 3

Re: Sort pull requests by `mergedAt` property (graphql, v4 API)

sort works for me!

search(query: "repo:myrepo is:pr is:merged sort:created-desc", type: ISSUE, last: 10)

 

ps: GHE