@@ -169,6 +169,14 @@ The \`git-artifacts-aarch64\` workflow run [was started](dispatched-workflow-git
169169` )
170170 return { html_url : 'https://github.com/git-for-windows/git/pull/4322#issuecomment-1450703020' }
171171 }
172+ if ( method === 'GET' && requestPath ===
173+ '/repos/git-for-windows/git-snapshots/releases/tags/prerelease-2.48.0-rc2.windows.1-472-g0c796d3013-20250128120446' ) {
174+ throw { statusCode : 404 }
175+ }
176+ if ( method === 'GET' && requestPath ===
177+ '/repos/git-for-windows/git/compare/HEAD...0c796d3013a57e8cc894c152f0200107226e5dd1' ) {
178+ return { behind_by : 0 }
179+ }
172180 throw new Error ( `Unhandled ${ method } -${ requestPath } -${ JSON . stringify ( payload ) } ` )
173181} )
174182jest . mock ( '../GitForWindowsHelper/github-api-request' , ( ) => {
@@ -426,6 +434,19 @@ let mockListCheckRunsForCommit = jest.fn((_context, _token, _owner, _repo, rev,
426434 }
427435 return [ { id, status : 'completed' , conclusion : 'success' , output } ]
428436 }
437+ if ( rev === '0c796d3013a57e8cc894c152f0200107226e5dd1' ) {
438+ const id = {
439+ 'git-artifacts-x86_64' : 13010015190 ,
440+ 'git-artifacts-i686' : 13010015938 ,
441+ 'git-artifacts-aarch64' : 13010016895
442+ } [ checkRunName ]
443+ const output = {
444+ title : 'Build Git v2.48.0-rc2.windows.1-472-g0c796d3013-20250128120446 artifacts' ,
445+ summary : 'Build Git v2.48.0-rc2.windows.1-472-g0c796d3013-20250128120446 artifacts from commit 0c796d3013a57e8cc894c152f0200107226e5dd1 (tag-git run #13009996573)' ,
446+ text : `For details, see [this run](https://github.com/git-for-windows/git-for-windows-automation/actions/runs/${ id } )`
447+ }
448+ return [ { id, status : 'completed' , conclusion : 'success' , output } ]
449+ }
429450 if ( rev === 'dee501d15' ) {
430451 if ( checkRunName === 'tag-git' ) return [ {
431452 status : 'completed' ,
@@ -917,3 +938,63 @@ test('a completed `release-git` run updates the `main` branch in git-for-windows
917938 throw e ;
918939 }
919940} )
941+
942+ test ( 'the third completed `git-artifacts-<arch>` check-run triggers an `upload-snapshot`' , async ( ) => {
943+ const context = makeContext ( {
944+ action : 'completed' ,
945+ check_run : {
946+ name : 'git-artifacts-aarch64' ,
947+ head_sha : '0c796d3013a57e8cc894c152f0200107226e5dd1' ,
948+ status : 'completed' ,
949+ conclusion : 'success' ,
950+ details_url : 'https://url-to-git-artifacts-aarch64/' ,
951+ output : {
952+ title : 'Build Git v2.48.0-rc2.windows.1-472-g0c796d3013-20250128120446 artifacts' ,
953+ summary : 'Build Git v2.48.0-rc2.windows.1-472-g0c796d3013-20250128120446 artifacts from commit 0c796d3013a57e8cc894c152f0200107226e5dd1 (tag-git run #13009996573)' ,
954+ text : 'For details, see [this run](https://github.com/git-for-windows/git-for-windows-automation/actions/runs/13010016895).'
955+ }
956+ } ,
957+ installation : {
958+ id : 123
959+ } ,
960+ repository : {
961+ name : 'git' ,
962+ owner : {
963+ login : 'git-for-windows'
964+ } ,
965+ full_name : 'git-for-windows/git'
966+ }
967+ } , {
968+ 'x-github-event' : 'check_run'
969+ } )
970+
971+ try {
972+ expect ( await index ( context , context . req ) ) . toBeUndefined ( )
973+ expect ( context . res ) . toEqual ( {
974+ body : `The 'upload-snapshot' workflow run was started at dispatched-workflow-upload-snapshot.yml` ,
975+ headers : undefined ,
976+ status : undefined
977+ } )
978+ expect ( mockGitHubApiRequest ) . toHaveBeenCalled ( )
979+ expect ( mockGitHubApiRequest . mock . calls [ 0 ] . slice ( 1 ) ) . toEqual ( [
980+ 'installation-access-token' ,
981+ 'GET' ,
982+ '/repos/git-for-windows/git-snapshots/releases/tags/prerelease-2.48.0-rc2.windows.1-472-g0c796d3013-20250128120446'
983+ ] )
984+ expect ( mockGitHubApiRequest . mock . calls [ 2 ] . slice ( 1 ) ) . toEqual ( [
985+ 'installation-access-token' ,
986+ 'POST' ,
987+ '/repos/git-for-windows/git-for-windows-automation/actions/workflows/upload-snapshot.yml/dispatches' , {
988+ ref : 'main' ,
989+ inputs : {
990+ git_artifacts_aarch64_workflow_run_id : "13010016895" ,
991+ git_artifacts_i686_workflow_run_id : "13010015938" ,
992+ git_artifacts_x86_64_workflow_run_id : "13010015190"
993+ }
994+ }
995+ ] )
996+ } catch ( e ) {
997+ context . log . mock . calls . forEach ( e => console . log ( e [ 0 ] ) )
998+ throw e ;
999+ }
1000+ } )
0 commit comments