Search code examples
githubgraphqlgithub-apigithub-graphql

using graphql github api to filter pr's merged between two dates


if you sign into https://developer.github.com/v4/explorer/ and run this query

{
  search(query: "org:ruby is:pr merged:<2019-07-11", type: ISSUE, last: 5) {
    edges {
      node {
        ... on PullRequest {
          url 
          mergedAt
          commits(first: 12) {
            totalCount 
          }
        }
      }
    }
  }
}

I can get all the pr that were merged before 2019-07-11 I would like to get the pr's merged before 2019-07-11 AND after 2019-07-04

using query: "org:ruby is:pr merged:<2019-07-11 and is:pr merged:>2019-07-04 " does not filter. Is there an elegant way to do this?


Solution

  • Just add another merged condition:

    org:ruby is:pr merged:<2019-07-11 merged:>2019-07-04
    

    or use range syntax:

    org:ruby is:pr merged:2019-07-04..2019-07-11
    

    See here for additional details.