HACK: `EnhancedGitHubClient.paginate` from Probot doesn't seem to be working as expected
- Increase page size to 100
This commit is contained in:
parent
349223d669
commit
97e358e1f5
|
@ -75,7 +75,7 @@ async function getReviewApprovalState (github, robot, repo, pullRequest) {
|
||||||
async function getPullRequestReviewStates (github, repo, pullRequest) {
|
async function getPullRequestReviewStates (github, repo, pullRequest) {
|
||||||
var finalReviewsMap = new Map()
|
var finalReviewsMap = new Map()
|
||||||
const ghreviews = await github.paginate(
|
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)
|
res => res.data)
|
||||||
for (var review of ghreviews) {
|
for (var review of ghreviews) {
|
||||||
switch (review.state) {
|
switch (review.state) {
|
||||||
|
@ -147,24 +147,25 @@ async function checkOpenPullRequests (robot, context) {
|
||||||
let ghcolumns
|
let ghcolumns
|
||||||
try {
|
try {
|
||||||
ghcolumns = await github.projects.getProjectColumns({ project_id: project.id })
|
ghcolumns = await github.projects.getProjectColumns({ project_id: project.id })
|
||||||
|
ghcolumns = ghcolumns.data
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
robot.log.error(`Couldn't fetch the github columns for project: ${err}`, ownerName, repoName, project.id)
|
robot.log.error(`Couldn't fetch the github columns for project: ${err}`, ownerName, repoName, project.id)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const contributorColumn = ghcolumns.data.find(c => c.name === contributorColumnName)
|
const contributorColumn = ghcolumns.find(c => c.name === contributorColumnName)
|
||||||
if (!contributorColumn) {
|
if (!contributorColumn) {
|
||||||
robot.log.error(`Couldn't find ${contributorColumnName} column in project ${project.name}`)
|
robot.log.error(`Couldn't find ${contributorColumnName} column in project ${project.name}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const reviewColumn = ghcolumns.data.find(c => c.name === reviewColumnName)
|
const reviewColumn = ghcolumns.find(c => c.name === reviewColumnName)
|
||||||
if (!reviewColumn) {
|
if (!reviewColumn) {
|
||||||
robot.log.error(`Couldn't find ${reviewColumnName} column in project ${project.name}`)
|
robot.log.error(`Couldn't find ${reviewColumnName} column in project ${project.name}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const testColumn = ghcolumns.data.find(c => c.name === testColumnName)
|
const testColumn = ghcolumns.find(c => c.name === testColumnName)
|
||||||
if (!testColumn) {
|
if (!testColumn) {
|
||||||
robot.log.error(`Couldn't find ${testColumnName} column in project ${project.name}`)
|
robot.log.error(`Couldn't find ${testColumnName} column in project ${project.name}`)
|
||||||
return
|
return
|
||||||
|
@ -175,7 +176,7 @@ async function checkOpenPullRequests (robot, context) {
|
||||||
try {
|
try {
|
||||||
// Gather all open PRs in this repo
|
// Gather all open PRs in this repo
|
||||||
const allPullRequests = await github.paginate(
|
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
|
res => res.data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue