HACK: `EnhancedGitHubClient.paginate` from Probot doesn't seem to be working as expected

- Increase page size to 100
This commit is contained in:
Pedro Pombeiro 2018-02-05 16:47:03 +01:00
parent 349223d669
commit 97e358e1f5
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
1 changed files with 6 additions and 5 deletions

View File

@ -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
)