Better message when CI for base commit is pending
Andrew Clark committed
Apr 11, 2019 at 19:23 UTC
ed6798405d610a121b21a4cbf6f74c030e913e35
1 file changed
+12
-5
dangerfile.js
+12
-5
@@ -127,15 +127,22 @@ function git(args) {
127
const statuses = await statusesResponse.json();
128
for (let i = 0; i < statuses.length; i++) {
129
const status = statuses[i];
130
- if (status.context === 'ci/circleci' && status.state === 'success') {
131
- baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec(
132
- status.target_url
133
- )[1];
130
+ if (status.context === 'ci/circleci') {
131
+ if (status.state === 'success') {
132
+ baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec(
133
+ status.target_url
134
+ )[1];
135
+ break;
136
+ }
137
+ if (status.state === 'failure') {
138
+ warn(`Base commit is broken: ${baseCommit}`);
139
+ return;
140
+ }
141
}
142
}
143
144
if (baseCIBuildId === null) {
138
- warn(`Base commit is broken: ${baseCommit}`);
145
+ warn(`Could not find build artifacts for base commit: ${baseCommit}`);
146
return;
147
}
148