lib/pullRequests.js
function getDiffForPR(pr) {
  print(['Get diff for PR ', clc.yellow.bold(`${pr.head.user.login}/${pr.head.repo.name}#${pr.number}`)], debug);
  return new Promise((resolve) => {
    github.repos.compareCommits({
      user: pr.head.user.login,
      repo: pr.head.repo.name,
      head: pr.head.ref,
      base: pr.base.ref
    }, (err, diff) => {
      if (err && debug) {
        print(['Error fetching diffs for PR ', clc.red.bold`${pr.head.user.login}/${pr.head.repo.name}#${pr.number}`], debug);
      }
      diff.user = pr.head.user.login;
      diff.repo = pr.head.repo.name;
      diff.title = pr.title;
      diff.number = pr.number;
      diff.link = pr._links.html.href;
      diff.createdAt = pr.created_at;
      diff.createdAt = pr.updated_at;
      diff.labels = pr.labels;
      return resolve(extractDiffData(diff));
    });
  });
}
function getDiffForPR(pr) {
  print(['Get diff for PR ', clc.yellow.bold(`${pr.head.user.login}/${pr.head.repo.name}#${pr.number}`)], debug);
  return new Promise((resolve) => {
    github.repos.compareCommits({
      user: pr.head.user.login,
      repo: pr.head.repo.name,
      head: pr.head.ref,
      base: pr.base.ref
    }, (err, diff) => {
      if (err && debug) {
        print(['Error fetching diffs for PR ', clc.red.bold`${pr.head.user.login}/${pr.head.repo.name}#${pr.number}`], debug);
      }
      diff.user = pr.head.user.login;
      diff.repo = pr.head.repo.name;
      diff.title = pr.title;
      diff.number = pr.number;
      diff.link = pr._links.html.href;
      diff.createdAt = pr.created_at;
      diff.createdAt = pr.updated_at;
      diff.labels = pr.labels;
      return resolve(extractDiffData(diff));
    });
  });
}
function getDiffForPR ( pr ) { print ( [ 'Get diff for PR ' , clc . yellow . bold ( ` ${ pr . head . user . login } ${ pr . head . repo . name } ${ pr . number } ` ) ] , debug ) ; return new Promise ( ( resolve ) => { github . repos . compareCommits ( { user : pr . head . user . login , repo : pr . head . repo . name , head : pr . head . ref , base : pr . base . ref } , ( err , diff ) => { if ( err && debug ) { print ( [ 'Error fetching diffs for PR ' , clc . red . bold ` ${ pr . head . user . login } ${ pr . head . repo . name } ${ pr . number } ` ] , debug ) ; } diff . user = pr . head . user . login ; diff . repo = pr . head . repo . name ; diff . title = pr . title ; diff . number = pr . number ; diff . link = pr . _links . html . href ; diff . createdAt = pr . created_at ; diff . createdAt = pr . updated_at ; diff . labels = pr . labels ; return resolve ( extractDiffData ( diff ) ) ; } ) ; } ) ; }
Fetch the diff for a single pull-request
@param  {Object}  pr Pull-request metadata
@return {Promise}    Resolves to an array of labels
Fetch the diff for a single pull - request