Hub: Retrieve pull requests by date range

Created on 16 Mar 2019  路  4Comments  路  Source: github/hub

It seems hub pr only allows to retrieve the last X (given by -L X) pull requests filtered by state.

It would be great (if the github API allows) if we could retrieve all PRs that were opened/closed/... within a given date range.

feature

Most helpful comment

@namanbada0606

{
  search(first: 100, query: "repo:github/hub is:pr is:open created:2019-10-31..2020-01-01", type: ISSUE) {
    nodes {
      ... on PullRequest {
        title
        url
      }
    }
  }
}

All 4 comments

This would be nice, especially because it would match the capabilities of the web view too. Unfortunately, it's not possible using the REST API yet. See https://github.com/github/hub/issues/2079#issuecomment-472507867 for explanation why we would need to switch to using Search for this

Agree, we need date filters by either of the following
createdAt
closedAt
updatedAt
or
mergedAt

This is my graphql query, cannot find a way out to filter the data

query query($owner: String!, $name: String!) {
  repository(owner: $owner, name: $name) {
    pullRequests(first: 50, states: MERGED, orderBy: {field: UPDATED_AT, direction: ASC}) {
      edges {
        node {
          author {
            login
          }
          createdAt
          closedAt
          updatedAt
          mergedAt
          id
          title
          url
          comments {
            totalCount
          }
          additions
          changedFiles
          deletions
        }
        cursor
      }
    }
  }
}

@namanbada0606

{
  search(first: 100, query: "repo:github/hub is:pr is:open created:2019-10-31..2020-01-01", type: ISSUE) {
    nodes {
      ... on PullRequest {
        title
        url
      }
    }
  }
}

Thank you @mislav for a workaround solution, that stuff worked for me, Ideally i wish to have it at pullRequests level.

really appreciate your timely help. You are awesome!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jfritzbarnes picture jfritzbarnes  路  3Comments

mshick picture mshick  路  3Comments

cbeams picture cbeams  路  4Comments

wwwdata picture wwwdata  路  3Comments

nicksergeant picture nicksergeant  路  3Comments