screwdriver-api 8.0.37 → 8.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/events/create.js +28 -16
package/package.json
CHANGED
package/plugins/events/create.js
CHANGED
|
@@ -153,7 +153,11 @@ module.exports = () => ({
|
|
|
153
153
|
|
|
154
154
|
// Update admins
|
|
155
155
|
if (!prNum) {
|
|
156
|
-
|
|
156
|
+
try {
|
|
157
|
+
await updateAdmins({ permissions, pipeline, user });
|
|
158
|
+
} catch (err) {
|
|
159
|
+
throw boom.boomify(err, { statusCode: err.statusCode });
|
|
160
|
+
}
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
// Get scmConfig
|
|
@@ -171,16 +175,21 @@ module.exports = () => ({
|
|
|
171
175
|
payload.prNum = String(prNum);
|
|
172
176
|
payload.type = 'pr';
|
|
173
177
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
let files;
|
|
179
|
+
let prInfo;
|
|
180
|
+
|
|
181
|
+
try {
|
|
182
|
+
[files, prInfo] = await Promise.all([
|
|
183
|
+
scm.getChangedFiles({
|
|
184
|
+
webhookConfig: null,
|
|
185
|
+
type: 'pr',
|
|
186
|
+
...scmConfig
|
|
187
|
+
}),
|
|
188
|
+
scm.getPrInfo(scmConfig)
|
|
189
|
+
]);
|
|
190
|
+
} catch (err) {
|
|
182
191
|
throw boom.boomify(err, { statusCode: err.statusCode });
|
|
183
|
-
}
|
|
192
|
+
}
|
|
184
193
|
|
|
185
194
|
if (files && files.length) {
|
|
186
195
|
payload.changedFiles = files;
|
|
@@ -196,14 +205,17 @@ module.exports = () => ({
|
|
|
196
205
|
restrictPR = pipeline.annotations[ANNOT_RESTRICT_PR];
|
|
197
206
|
}
|
|
198
207
|
|
|
199
|
-
// PR author should be able to rerun their own PR build if restrictPR is not on
|
|
200
208
|
if (restrictPR !== 'none' || prInfo.username !== username) {
|
|
201
209
|
// Remove user from admins
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
210
|
+
try {
|
|
211
|
+
await updateAdmins({
|
|
212
|
+
permissions,
|
|
213
|
+
pipeline,
|
|
214
|
+
user
|
|
215
|
+
});
|
|
216
|
+
} catch (err) {
|
|
217
|
+
throw boom.boomify(err, { statusCode: err.statusCode });
|
|
218
|
+
}
|
|
207
219
|
}
|
|
208
220
|
}
|
|
209
221
|
|