isStale = (pullRequest, staleDays) => {
  const lastCommitDate = new Date(
    pullRequest.commits.nodes[0].commit.pushedDate,
  );
  if (pullRequest.reviews.nodes[0]) {
    const lastReviewDate = new Date(
      pullRequest.reviews.nodes.sort((a, b) => (a < b ? 1 : -1))[0].submittedAt,
    );
    const lastUpdateDate =
      lastCommitDate >= lastReviewDate ? lastCommitDate : lastReviewDate;
    const now = new Date();
    return (now - lastUpdateDate) / (1000 * 60 * 60 * 24) >= staleDays;
  } else {
    return false;
  }
}
Check if PR is stale. Meaning that it hasn't been updated in a given time.

@param {Object} pullRequest request object.
@param {number} staleDays number of days.
@returns {boolean} indicating if PR is stale.