@@ -460,6 +460,29 @@ let mockListCheckRunsForCommit = jest.fn((_context, _token, _owner, _repo, rev,
460
460
} ]
461
461
return [ ]
462
462
}
463
+ if ( rev === '88811' ) {
464
+ if ( checkRunName === 'tag-git' ) return [ {
465
+ conclusion : 'success' ,
466
+ status : 'completed' ,
467
+ output : {
468
+ summary : 'Tag Git already-tagged @88811'
469
+ } ,
470
+ id : 123
471
+ } ]
472
+ if ( checkRunName . startsWith ( 'git-artifacts' ) ) {
473
+ const id = {
474
+ 'git-artifacts-x86_64' : 8664 ,
475
+ 'git-artifacts-i686' : 686 ,
476
+ 'git-artifacts-aarch64' :64 ,
477
+ } [ checkRunName ]
478
+ const output = {
479
+ title : 'Build already-tagged artifacts' ,
480
+ summary : 'Build Git already-tagged artifacts from commit 88811 (tag-git run #123)' ,
481
+ text : `For details, see [this run](https://github.com/git-for-windows/git-for-windows-automation/actions/runs/${ id } )`
482
+ }
483
+ return [ { id, status : 'completed' , conclusion : 'success' , output } ]
484
+ }
485
+ }
463
486
if ( checkRunName === 'git-artifacts-x86_64' ) return [ {
464
487
status : 'completed' ,
465
488
conclusion : 'success' ,
@@ -998,3 +1021,47 @@ test('the third completed `git-artifacts-<arch>` check-run triggers an `upload-s
998
1021
throw e ;
999
1022
}
1000
1023
} )
1024
+
1025
+ test ( 'a `push` triggers a `tag-git` or an `upload-snapshot` run' , async ( ) => {
1026
+ const context = makeContext ( {
1027
+ ref : 'refs/heads/main' ,
1028
+ after : 'no-tag-git-yet' ,
1029
+ installation : {
1030
+ id : 123
1031
+ } ,
1032
+ repository : {
1033
+ name : 'git' ,
1034
+ owner : {
1035
+ login : 'git-for-windows'
1036
+ } ,
1037
+ full_name : 'git-for-windows/git'
1038
+ }
1039
+ } , {
1040
+ 'x-github-event' : 'push'
1041
+ } )
1042
+
1043
+ try {
1044
+ expect ( await index ( context , context . req ) ) . toBeUndefined ( )
1045
+ expect ( context . res ) . toEqual ( {
1046
+ body : `The 'tag-git' workflow run was started at dispatched-workflow-tag-git.yml` ,
1047
+ headers : undefined ,
1048
+ status : undefined
1049
+ } )
1050
+ } catch ( e ) {
1051
+ context . log . mock . calls . forEach ( e => console . log ( e [ 0 ] ) )
1052
+ throw e ;
1053
+ }
1054
+
1055
+ context . req . body . after = '88811'
1056
+ try {
1057
+ expect ( await index ( context , context . req ) ) . toBeUndefined ( )
1058
+ expect ( context . res ) . toEqual ( {
1059
+ body : `The 'upload-snapshot' workflow run was started at dispatched-workflow-upload-snapshot.yml` ,
1060
+ headers : undefined ,
1061
+ status : undefined
1062
+ } )
1063
+ } catch ( e ) {
1064
+ context . log . mock . calls . forEach ( e => console . log ( e [ 0 ] ) )
1065
+ throw e ;
1066
+ }
1067
+ } )
0 commit comments