@@ -27,7 +27,7 @@ test.afterEach.always(() => {
27
27
} ) ;
28
28
29
29
test . serial (
30
- 'Add comment and labels to PRs associated with release commits and issues closed by PR/commits comments' ,
30
+ 'Add comment and labels to PRs associated with release commits and issues solved by PR/commits comments' ,
31
31
async t => {
32
32
const owner = 'test_user' ;
33
33
const repo = 'test_repo' ;
@@ -73,14 +73,10 @@ test.serial(
73
73
. reply ( 200 , { html_url : 'https://github.com/successcomment-2' } )
74
74
. post ( `/repos/${ redirectedOwner } /${ redirectedRepo } /issues/2/labels` , '["released"]' )
75
75
. reply ( 200 , { } )
76
- . get ( `/repos/${ redirectedOwner } /${ redirectedRepo } /issues/3` )
77
- . reply ( 200 , { state : 'closed' } )
78
76
. post ( `/repos/${ redirectedOwner } /${ redirectedRepo } /issues/3/comments` , { body : / T h i s i s s u e h a s b e e n r e s o l v e d / } )
79
77
. reply ( 200 , { html_url : 'https://github.com/successcomment-3' } )
80
78
. post ( `/repos/${ redirectedOwner } /${ redirectedRepo } /issues/3/labels` , '["released"]' )
81
79
. reply ( 200 , { } )
82
- . get ( `/repos/${ redirectedOwner } /${ redirectedRepo } /issues/4` )
83
- . reply ( 200 , { state : 'closed' } )
84
80
. post ( `/repos/${ redirectedOwner } /${ redirectedRepo } /issues/4/comments` , { body : / T h i s i s s u e h a s b e e n r e s o l v e d / } )
85
81
. reply ( 200 , { html_url : 'https://github.com/successcomment-4' } )
86
82
. post ( `/repos/${ redirectedOwner } /${ redirectedRepo } /issues/4/labels` , '["released"]' )
@@ -147,14 +143,10 @@ test.serial(
147
143
. reply ( 200 , { html_url : 'https://custom-url.com/successcomment-2' } )
148
144
. post ( `/repos/${ owner } /${ repo } /issues/2/labels` , '["released on @next"]' )
149
145
. reply ( 200 , { } )
150
- . get ( `/repos/${ owner } /${ repo } /issues/3` )
151
- . reply ( 200 , { state : 'closed' } )
152
146
. post ( `/repos/${ owner } /${ repo } /issues/3/comments` , { body : / T h i s i s s u e h a s b e e n r e s o l v e d / } )
153
147
. reply ( 200 , { html_url : 'https://custom-url.com/successcomment-3' } )
154
148
. post ( `/repos/${ owner } /${ repo } /issues/3/labels` , '["released on @next"]' )
155
149
. reply ( 200 , { } )
156
- . get ( `/repos/${ owner } /${ repo } /issues/4` )
157
- . reply ( 200 , { state : 'closed' } )
158
150
. post ( `/repos/${ owner } /${ repo } /issues/4/comments` , { body : / T h i s i s s u e h a s b e e n r e s o l v e d / } )
159
151
. reply ( 200 , { html_url : 'https://custom-url.com/successcomment-4' } )
160
152
. post ( `/repos/${ owner } /${ repo } /issues/4/labels` , '["released on @next"]' )
@@ -330,49 +322,6 @@ test.serial(
330
322
}
331
323
) ;
332
324
333
- test . serial ( 'Do not add comment and labels to open issues/PRs' , async t => {
334
- const owner = 'test_user' ;
335
- const repo = 'test_repo' ;
336
- const env = { GITHUB_TOKEN : 'github_token' } ;
337
- const failTitle = 'The automated release is failing 🚨' ;
338
- const pluginConfig = { failTitle} ;
339
- const prs = [ { number : 1 , pull_request : { } , body : 'Fixes #2' , state : 'closed' } ] ;
340
- const options = { branch : 'master' , repositoryUrl : `https://github.com/${ owner } /${ repo } .git` } ;
341
- const commits = [ { hash : '123' , message : 'Commit 1 message' } ] ;
342
- const nextRelease = { version : '1.0.0' } ;
343
- const releases = [ { name : 'GitHub release' , url : 'https://github.com/release' } ] ;
344
- const github = authenticate ( env )
345
- . get ( `/repos/${ owner } /${ repo } ` )
346
- . reply ( 200 , { full_name : `${ owner } /${ repo } ` } )
347
- . get (
348
- `/search/issues?q=${ escape ( `repo:${ owner } /${ repo } ` ) } +${ escape ( 'type:pr' ) } +${ escape ( 'is:merged' ) } +${ commits
349
- . map ( commit => commit . hash )
350
- . join ( '+' ) } `
351
- )
352
- . reply ( 200 , { items : prs } )
353
- . get ( `/repos/${ owner } /${ repo } /pulls/1/commits` )
354
- . reply ( 200 , [ { sha : commits [ 0 ] . hash } ] )
355
- . post ( `/repos/${ owner } /${ repo } /issues/1/comments` , { body : / T h i s P R i s i n c l u d e d / } )
356
- . reply ( 200 , { html_url : 'https://github.com/successcomment-1' } )
357
- . post ( `/repos/${ owner } /${ repo } /issues/1/labels` , '["released"]' )
358
- . reply ( 200 , { } )
359
- . get ( `/repos/${ owner } /${ repo } /issues/2` )
360
- . reply ( 200 , { state : 'open' } )
361
- . get (
362
- `/search/issues?q=${ escape ( 'in:title' ) } +${ escape ( `repo:${ owner } /${ repo } ` ) } +${ escape ( 'type:issue' ) } +${ escape (
363
- 'state:open'
364
- ) } +${ escape ( failTitle ) } `
365
- )
366
- . reply ( 200 , { items : [ ] } ) ;
367
-
368
- await success ( pluginConfig , { env, options, commits, nextRelease, releases, logger : t . context . logger } ) ;
369
-
370
- t . true ( t . context . log . calledWith ( 'Added comment to issue #%d: %s' , 1 , 'https://github.com/successcomment-1' ) ) ;
371
- t . true ( t . context . log . calledWith ( 'Added labels %O to issue #%d' , [ 'released' ] , 1 ) ) ;
372
- t . true ( t . context . log . calledWith ( "Skip comment and labels on issue #%d as it's open: %s" , 2 ) ) ;
373
- t . true ( github . isDone ( ) ) ;
374
- } ) ;
375
-
376
325
test . serial ( 'Do not add comment and labels if no PR is associated with release commits' , async t => {
377
326
const owner = 'test_user' ;
378
327
const repo = 'test_repo' ;
@@ -427,8 +376,6 @@ test.serial('Do not add comment and labels to PR/issues from other repo', async
427
376
. join ( '+' ) } `
428
377
)
429
378
. reply ( 200 , { items : [ ] } )
430
- . get ( `/repos/${ owner } /${ repo } /issues/2` )
431
- . reply ( 200 , { state : 'closed' } )
432
379
. post ( `/repos/${ owner } /${ repo } /issues/2/comments` , { body : / T h i s i s s u e h a s b e e n r e s o l v e d / } )
433
380
. reply ( 200 , { html_url : 'https://github.com/successcomment-2' } )
434
381
. post ( `/repos/${ owner } /${ repo } /issues/2/labels` , '["released"]' )
@@ -481,8 +428,6 @@ test.serial('Ignore missing issues/PRs', async t => {
481
428
. post ( `/repos/${ owner } /${ repo } /issues/2/comments` , { body : / T h i s P R i s i n c l u d e d / } )
482
429
. times ( 3 )
483
430
. reply ( 404 )
484
- . get ( `/repos/${ owner } /${ repo } /issues/3` )
485
- . reply ( 200 , { state : 'closed' } )
486
431
. post ( `/repos/${ owner } /${ repo } /issues/3/comments` , { body : / T h i s i s s u e h a s b e e n r e s o l v e d / } )
487
432
. reply ( 200 , { html_url : 'https://github.com/successcomment-3' } )
488
433
. post ( `/repos/${ owner } /${ repo } /issues/3/labels` , '["released"]' )
0 commit comments