From 97e358e1f534dafbba8c1ddc77ce0d0c1bdb3281 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Mon, 5 Feb 2018 16:47:03 +0100 Subject: [PATCH] HACK: `EnhancedGitHubClient.paginate` from Probot doesn't seem to be working as expected - Increase page size to 100 --- bot_scripts/assign-approved-pr-to-test.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bot_scripts/assign-approved-pr-to-test.js b/bot_scripts/assign-approved-pr-to-test.js index 36a90ac..23e2895 100644 --- a/bot_scripts/assign-approved-pr-to-test.js +++ b/bot_scripts/assign-approved-pr-to-test.js @@ -75,7 +75,7 @@ async function getReviewApprovalState (github, robot, repo, pullRequest) { async function getPullRequestReviewStates (github, repo, pullRequest) { var finalReviewsMap = new Map() const ghreviews = await github.paginate( - github.pullRequests.getReviews({owner: repo.owner.login, repo: repo.name, number: pullRequest.number}), + github.pullRequests.getReviews({owner: repo.owner.login, repo: repo.name, number: pullRequest.number, per_page: 100}), res => res.data) for (var review of ghreviews) { switch (review.state) { @@ -147,24 +147,25 @@ async function checkOpenPullRequests (robot, context) { let ghcolumns try { ghcolumns = await github.projects.getProjectColumns({ project_id: project.id }) + ghcolumns = ghcolumns.data } catch (err) { robot.log.error(`Couldn't fetch the github columns for project: ${err}`, ownerName, repoName, project.id) return } - const contributorColumn = ghcolumns.data.find(c => c.name === contributorColumnName) + const contributorColumn = ghcolumns.find(c => c.name === contributorColumnName) if (!contributorColumn) { robot.log.error(`Couldn't find ${contributorColumnName} column in project ${project.name}`) return } - const reviewColumn = ghcolumns.data.find(c => c.name === reviewColumnName) + const reviewColumn = ghcolumns.find(c => c.name === reviewColumnName) if (!reviewColumn) { robot.log.error(`Couldn't find ${reviewColumnName} column in project ${project.name}`) return } - const testColumn = ghcolumns.data.find(c => c.name === testColumnName) + const testColumn = ghcolumns.find(c => c.name === testColumnName) if (!testColumn) { robot.log.error(`Couldn't find ${testColumnName} column in project ${project.name}`) return @@ -175,7 +176,7 @@ async function checkOpenPullRequests (robot, context) { try { // Gather all open PRs in this repo const allPullRequests = await github.paginate( - github.pullRequests.getAll({owner: ownerName, repo: repoName}), + github.pullRequests.getAll({owner: ownerName, repo: repoName, per_page: 100}), res => res.data )