From ee082627c4fade931f77a463060b3af1dd21f4a5 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Mon, 25 Feb 2019 21:54:43 +0100 Subject: [PATCH] trigger-automation-test-build: Keep checking PR while android build is failing and trigger once build is passing --- bot_scripts/trigger-automation-test-build.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot_scripts/trigger-automation-test-build.js b/bot_scripts/trigger-automation-test-build.js index 3b9e28a..e42770e 100644 --- a/bot_scripts/trigger-automation-test-build.js +++ b/bot_scripts/trigger-automation-test-build.js @@ -115,17 +115,22 @@ async function processPullRequest (context, robot, prInfo, fullJobName) { robot.log.warn(`${botName} - Could not find PR`, prInfo) return } + if (pullRequest.state === 'closed') { + robot.log.info(`${botName} - PR is closed, discarded`, prInfo) + return + } const statusContext = 'jenkins/prs/android-e2e' const currentStatus = await gitHubHelpers.getPullRequestCurrentStatusForContext(context, statusContext, pullRequest) switch (currentStatus) { + case undefined: case 'pending': + case 'failure': pendingPullRequests.set(prInfo.number, { github: github, prInfo, fullJobName: fullJobName }) robot.log.debug(`${botName} - Status for ${statusContext} is '${currentStatus}', adding to backlog to check periodically`, prInfo) return case 'error': - case 'failure': robot.log.debug(`${botName} - Status for ${statusContext} is '${currentStatus}', exiting`, prInfo) return case 'success':