How to query Pull Requests merged within past 7 days?


#1

I’m new to GraphQL, and after some tinkering I have the following query:

{
  repositoryOwner(login: "duckduckgo") {
    repository(name: "zeroclickinfo-fathead") {
      pullRequests(last: 30, states: [MERGED]) {
        edges {
          node {
            title
            number
            timeline(last: 10, since: "2016-11-01") {
              edges {
                node {
                  __typename
                  ... on MergedEvent{
                    createdAt
                    actor {
                      name
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

From what I can tell, this gives me a list of the last 30 PRs with a state of “merged”, and a list of the last 10 events for each, that occurred since November 1st.

Some have an empty event list, suggesting they have no events since Nov 1st, meaning they were merged before that date. Some have a “MergedEvent”, suggesting that they were merged since Nov 1st.

I know we haven’t merged 31+ PRs since Nov 1st, so this should be all merged PRs since that date, but it’s possible that we could have, and so this query wouldn’t give me what I want.

Is there a better way to query for MergeEvents on a Repo that occurred since a specific date?

Thanks!


#2

Bueller?


#3

Use correct DateTime format.

ex: “2016-11-01T11:11:02Z”