Issue #398

How to

Technical

Dependencies

const Rx = require('rxjs/Rx')
const Fetch = require('node-fetch')
const Minimist = require('minimist')
const Fs = require('fs')

Use GraphQL

makeOptions(query, token) {
  return {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `bearer ${token}`
    },
    body: JSON.stringify({
      query: `
      query {
        repository(owner: "${this.owner}", name: "${this.repo}") {
          ${query}
        }
      }
      `
    })
  }
}

Use orderBy

fetchPRsAndIssues(dates) {
    const query = `
    pullRequests(last: 100, orderBy: {field: UPDATED_AT, direction: ASC}) {
      edges {
        node {
          title
          merged
          mergedAt
          url
          author {
            login
            url
          }
        }
      }
    }
    issues(last: 100, orderBy: {field: UPDATED_AT, direction: ASC}) {
      edges {
        node {
          title
          closed
          updatedAt
          url
        }
      }
    }
  }
}