assign-approved-pr-to-test: Add some logging and allow disabling initial delay

This commit is contained in:
Pedro Pombeiro 2018-04-18 11:53:38 +02:00
parent 5acbccca90
commit 2502a4a242
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
2 changed files with 5 additions and 1 deletions

View File

@ -20,7 +20,7 @@ const slackHelper = require('../lib/slack')
const botName = 'assign-approved-pr-to-test'
module.exports = robot => {
createScheduler(robot, { interval: 10 * 60 * 1000 })
createScheduler(robot, { interval: 10 * 60 * 1000, delay: !process.env.DISABLE_DELAY })
robot.on('schedule.repository', context => checkOpenPullRequests(robot, context))
}
@ -100,6 +100,7 @@ async function assignPullRequestToCorrectColumn (github, robot, repo, pullReques
const { srcColumns, dstColumn } = getColumns(state, columns)
if (!dstColumn) {
robot.log.debug(`${botName} - No dstColumn, state=${state}, columns=${JSON.stringify(columns)}, srcColumns=${srcColumns}`)
return
}

View File

@ -72,12 +72,15 @@ async function _getReviewApprovalState (github, robot, prInfo, testedPullRequest
if (approvedReviews.length >= threshold) {
const reviewsWithChangesRequested = finalReviews.filter(reviewState => reviewState === 'CHANGES_REQUESTED')
if (reviewsWithChangesRequested.length === 0) {
robot.log.debug(`No changes requested, considering state as approved`)
return 'approved'
}
robot.log.debug(`${reviewsWithChangesRequested.length} changes requested, considering state as changes_requested`)
return 'changes_requested'
}
robot.log.debug(`Not enough reviewers yet, considering state as awaiting_reviewers`)
return 'awaiting_reviewers'
}