@@ -49,26 +49,22 @@ export const LabelNames = [
49
49
] as const ;
50
50
51
51
export interface Actions {
52
- targetColumn ?: ColumnName ;
52
+ projectColumn ?: ColumnName | "REMOVE" ;
53
53
labels : LabelName [ ] ;
54
54
responseComments : Comments . Comment [ ] ;
55
55
shouldClose : boolean ;
56
56
shouldMerge : boolean ;
57
57
shouldUpdateLabels : boolean ;
58
- shouldUpdateProjectColumn : boolean ;
59
- shouldRemoveFromActiveColumns : boolean ;
60
58
}
61
59
62
60
function createDefaultActions ( ) : Actions {
63
61
return {
64
- targetColumn : "Other" ,
62
+ projectColumn : "Other" ,
65
63
labels : [ ] ,
66
64
responseComments : [ ] ,
67
65
shouldClose : false ,
68
66
shouldMerge : false ,
69
67
shouldUpdateLabels : true ,
70
- shouldUpdateProjectColumn : true ,
71
- shouldRemoveFromActiveColumns : false ,
72
68
} ;
73
69
}
74
70
@@ -79,8 +75,6 @@ function createEmptyActions(): Actions {
79
75
shouldClose : false ,
80
76
shouldMerge : false ,
81
77
shouldUpdateLabels : false ,
82
- shouldUpdateProjectColumn : false ,
83
- shouldRemoveFromActiveColumns : false ,
84
78
} ;
85
79
}
86
80
@@ -233,25 +227,17 @@ function extendPrInfo(info: PrInfo): ExtendedPrInfo {
233
227
export function process ( prInfo : BotResult ,
234
228
extendedCallback : ( info : ExtendedPrInfo ) => void = _i => { } ) : Actions {
235
229
if ( prInfo . type === "remove" ) {
236
- if ( prInfo . isDraft ) {
237
- return {
238
- ...createEmptyActions ( ) ,
239
- targetColumn : "Needs Author Action" ,
240
- shouldUpdateProjectColumn : true ,
241
- } ;
242
- } else {
243
- return {
244
- ...createEmptyActions ( ) ,
245
- shouldRemoveFromActiveColumns : true ,
246
- } ;
247
- }
230
+ return {
231
+ ...createEmptyActions ( ) ,
232
+ projectColumn : prInfo . isDraft ? "Needs Author Action" : "REMOVE" ,
233
+ } ;
248
234
}
249
235
250
236
const actions = createDefaultActions ( ) ;
251
237
const post = ( c : Comments . Comment ) => actions . responseComments . push ( c ) ;
252
238
253
239
if ( prInfo . type === "error" ) {
254
- actions . targetColumn = "Other" ;
240
+ actions . projectColumn = "Other" ;
255
241
actions . labels . push ( "Mergebot Error" ) ;
256
242
post ( Comments . HadError ( prInfo . author , prInfo . message ) ) ;
257
243
return actions ;
@@ -306,18 +292,18 @@ export function process(prInfo: BotResult,
306
292
}
307
293
308
294
// Some step should override this
309
- actions . targetColumn = "Other" ;
295
+ actions . projectColumn = "Other" ;
310
296
311
297
// Needs author attention (bad CI, merge conflicts)
312
298
if ( info . needsAuthorAction ) {
313
- actions . targetColumn = "Needs Author Action" ;
299
+ actions . projectColumn = "Needs Author Action" ;
314
300
if ( info . hasMergeConflict ) post ( Comments . MergeConflicted ( headCommitAbbrOid , info . author ) ) ;
315
301
if ( info . failedCI ) post ( Comments . CIFailed ( headCommitAbbrOid , info . author , info . ciUrl ! ) ) ;
316
302
if ( info . hasChangereqs ) post ( Comments . ChangesRequest ( headCommitAbbrOid , info . author ) ) ;
317
303
}
318
304
// CI is running; default column is Waiting for Reviewers
319
305
else if ( info . ciResult === "unknown" ) {
320
- actions . targetColumn = "Waiting for Code Reviews" ;
306
+ actions . projectColumn = "Waiting for Code Reviews" ;
321
307
}
322
308
// CI is missing
323
309
else if ( info . ciResult === "missing" ) {
@@ -327,13 +313,13 @@ export function process(prInfo: BotResult,
327
313
if ( dayjs ( info . now ) . diff ( info . lastPushDate , "minutes" ) >= 1 ) {
328
314
label ( "Where is GH Actions?" ) ;
329
315
} else {
330
- delete actions . targetColumn ;
316
+ delete actions . projectColumn ;
331
317
}
332
318
}
333
319
// CI is green
334
320
else if ( info . ciResult === "pass" ) {
335
321
if ( ! info . canBeSelfMerged ) {
336
- actions . targetColumn = info . reviewColumn ;
322
+ actions . projectColumn = info . reviewColumn ;
337
323
} else {
338
324
label ( "Self Merge" ) ;
339
325
// post even when merging, so it won't get deleted
@@ -342,9 +328,9 @@ export function process(prInfo: BotResult,
342
328
headCommitAbbrOid ) ) ;
343
329
if ( info . hasValidMergeRequest ) {
344
330
actions . shouldMerge = true ;
345
- actions . targetColumn = "Recently Merged" ;
331
+ actions . projectColumn = "Recently Merged" ;
346
332
} else {
347
- actions . targetColumn = "Waiting for Author to Merge" ;
333
+ actions . projectColumn = "Waiting for Author to Merge" ;
348
334
}
349
335
}
350
336
// Ping stale reviewers if any
@@ -384,9 +370,9 @@ function makeStaleness(now: Date, author: string, otherOwners: string[]) { // cu
384
370
if ( state === "done" ) {
385
371
if ( doneColumn === "CLOSE" ) {
386
372
actions . shouldClose = true ;
387
- actions . shouldRemoveFromActiveColumns = true ;
373
+ actions . projectColumn = "REMOVE" ;
388
374
} else {
389
- actions . targetColumn = doneColumn ;
375
+ actions . projectColumn = doneColumn ;
390
376
}
391
377
}
392
378
} ;
0 commit comments