mirror of
https://github.com/status-im/status-github-bot.git
synced 2025-01-27 05:24:57 +00:00
move PRs with conflict to TO REBASE column
Resolves: https://github.com/status-im/status-mobile/issues/13497 Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
2441f3c6cc
commit
a615eba94b
@ -55,6 +55,7 @@ async function checkOpenPullRequests (robot, context) {
|
||||
|
||||
const testedPullRequestLabelName = projectBoardConfig['tested-pr-label-name']
|
||||
const contributorColumnName = projectBoardConfig['contributor-column-name']
|
||||
const toRebaseColumnName = projectBoardConfig['to-rebase-column-name']
|
||||
const reviewColumnName = projectBoardConfig['review-column-name']
|
||||
const testColumnName = projectBoardConfig['test-column-name']
|
||||
const minReviewers = projectBoardConfig['min-reviewers'] || 1
|
||||
@ -76,12 +77,20 @@ async function checkOpenPullRequests (robot, context) {
|
||||
}
|
||||
|
||||
try {
|
||||
const contributorColumn = findColumnByName(ghcolumns, contributorColumnName)
|
||||
const reviewColumn = findColumnByName(ghcolumns, reviewColumnName)
|
||||
const testColumn = findColumnByName(ghcolumns, testColumnName)
|
||||
const columns = { contributor: contributorColumn, review: reviewColumn, test: testColumn }
|
||||
const columns = {
|
||||
contributor: findColumnByName(ghcolumns, contributorColumnName),
|
||||
rebase: findColumnByName(ghcolumns, toRebaseColumnName),
|
||||
review: findColumnByName(ghcolumns, reviewColumnName),
|
||||
test: findColumnByName(ghcolumns, testColumnName),
|
||||
}
|
||||
|
||||
robot.log.debug(`${botName} - Fetched ${contributorColumn.name} (${contributorColumn.id}), ${reviewColumn.name} (${reviewColumn.id}), ${testColumn.name} (${testColumn.id}) columns`)
|
||||
robot.log.debug(`
|
||||
${botName} - Fetched columns:
|
||||
${columns.contributor.name} (${columns.contributor.id})
|
||||
${columns.rebase.name} (${columns.rebase.id})
|
||||
${columns.review.name} (${columns.review.id})
|
||||
${columns.test.name} (${columns.test.id})
|
||||
`)
|
||||
|
||||
try {
|
||||
// Gather all open PRs in this repo
|
||||
@ -210,8 +219,8 @@ function getColumns (state, columns) {
|
||||
return { srcColumns: [columns.contributor, columns.test], dstColumn: columns.review }
|
||||
case 'changes_requested':
|
||||
return { srcColumns: [columns.review, columns.test], dstColumn: columns.contributor }
|
||||
case 'failed':
|
||||
return { srcColumns: [columns.review, columns.test], dstColumn: columns.contributor }
|
||||
case 'needs_rebase':
|
||||
return { srcColumns: [columns.contributor, columns.review, columns.test], dstColumn: columns.rebase }
|
||||
case 'approved':
|
||||
return { srcColumns: [columns.contributor, columns.review], dstColumn: columns.test }
|
||||
default:
|
||||
|
@ -39,11 +39,11 @@ async function _getReviewApprovalState (context, robot, prInfo, minReviewers, te
|
||||
const { github } = context
|
||||
|
||||
// Get detailed pull request
|
||||
const pullRequestPayload = await github.pullRequests.get(prInfo)
|
||||
const pullRequest = pullRequestPayload.data
|
||||
const pullrequestPayload = await github.pullRequests.get(prInfo)
|
||||
const pullRequest = pullrequestPayload.data
|
||||
context.payload.pull_request = pullRequest
|
||||
if (pullRequest.mergeable !== null && pullRequest.mergeable !== undefined && !pullRequest.mergeable) {
|
||||
robot.log.debug(`pullRequest.mergeable is ${pullRequest.mergeable}, considering as failed`)
|
||||
if (pullRequest.mergeable === false && pullRequest.mergeable_state != 'dirty') {
|
||||
robot.log.debug(`pullRequest #${prInfo.number} - pullRequest.mergeable is ${pullRequest.mergeable} and not dirty, considering as failed`)
|
||||
return 'failed'
|
||||
}
|
||||
|
||||
@ -54,11 +54,11 @@ async function _getReviewApprovalState (context, robot, prInfo, minReviewers, te
|
||||
robot.log.debug(`Pull request is labeled '${testedPullRequestLabelName}', ignoring`)
|
||||
return null
|
||||
}
|
||||
|
||||
state = 'approved'
|
||||
break
|
||||
case 'dirty':
|
||||
state = 'failed'
|
||||
robot.log.debug(`PR #${prInfo.number} - pullRequest.mergeable_state=${pullRequest.mergeable_state}, pullRequest.mergeable=${pullRequest.mergeable}`)
|
||||
state = 'needs_rebase'
|
||||
break
|
||||
case 'unstable':
|
||||
if (filterIgnoredStatusContextFn) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user