From ed6798405d610a121b21a4cbf6f74c030e913e35 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Thu, 11 Apr 2019 19:23:31 -0700 Subject: [PATCH] Better message when CI for base commit is pending --- dangerfile.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/dangerfile.js b/dangerfile.js index 86e0330ec50d4..bc09c29574d5e 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -127,15 +127,22 @@ function git(args) { const statuses = await statusesResponse.json(); for (let i = 0; i < statuses.length; i++) { const status = statuses[i]; - if (status.context === 'ci/circleci' && status.state === 'success') { - baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec( - status.target_url - )[1]; + if (status.context === 'ci/circleci') { + if (status.state === 'success') { + baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec( + status.target_url + )[1]; + break; + } + if (status.state === 'failure') { + warn(`Base commit is broken: ${baseCommit}`); + return; + } } } if (baseCIBuildId === null) { - warn(`Base commit is broken: ${baseCommit}`); + warn(`Could not find build artifacts for base commit: ${baseCommit}`); return; }