@@ -136,6 +136,12 @@ let mockGitHubApiRequest = jest.fn((_context, _token, method, requestPath, paylo
136136 if ( method === 'GET' && requestPath . endsWith ( '/pulls/765' ) ) return {
137137 head : { sha : 'c0ffee1ab7e' }
138138 }
139+ if ( method === 'GET' && requestPath . endsWith ( '/pulls/69' ) ) return {
140+ head : { sha : '59d71150a6ee93ab954221c43ca86f8eafe68ddc' }
141+ }
142+ if ( method === 'GET' && requestPath . endsWith ( '/pulls/177' ) ) return {
143+ head : { sha : '03bdffe5997' }
144+ }
139145 if ( method === 'PATCH' && requestPath . endsWith ( '/git/refs/heads/main' ) ) {
140146 if ( payload . sha !== 'c0ffee1ab7e' ) throw new Error ( `Unexpected sha: ${ payload . sha } ` )
141147 if ( payload . force !== false ) throw new Error ( `Unexpected force value: ${ payload . force } ` )
@@ -330,6 +336,44 @@ The MINGW workflow run [was started](dispatched-workflow-open-pr.yml)`
330336 } )
331337} )
332338
339+ testIssueComment ( '/open pr' , {
340+ repository : {
341+ name : 'msys2-runtime'
342+ } ,
343+ issue : {
344+ number : 69 ,
345+ title : 'Support OneDrive better' ,
346+ body : `This backports patches that avoid hydrating files on OneDrive _just_ to \`stat()\` them.
347+
348+ See also https://github.com/msys2/msys2-runtime/issues/206.` ,
349+ pull_request : {
350+ html_url : 'https://github.com/git-for-windows/msys2-runtime/pull/69'
351+ }
352+ }
353+ } , async ( context ) => {
354+ expect ( await index ( context , context . req ) ) . toBeUndefined ( )
355+ expect ( context . res ) . toEqual ( {
356+ body : `I edited the comment: appended-comment-body-existing comment body
357+
358+ The workflow run [was started](dispatched-workflow-open-pr.yml)` ,
359+ headers : undefined ,
360+ status : undefined
361+ } )
362+ expect ( mockGetInstallationAccessToken ) . toHaveBeenCalledTimes ( 1 )
363+ expect ( mockGitHubApiRequestAsApp ) . not . toHaveBeenCalled ( )
364+ expect ( dispatchedWorkflows ) . toHaveLength ( 1 )
365+ expect ( dispatchedWorkflows [ 0 ] . payload . inputs . package ) . toEqual ( 'msys2-runtime' )
366+ expect ( dispatchedWorkflows [ 0 ] . payload . inputs . version ) . toEqual ( '59d71150a6ee93ab954221c43ca86f8eafe68ddc' )
367+ expect ( mockGitHubApiRequest ) . toHaveBeenCalled ( )
368+ const msysComment = mockGitHubApiRequest . mock . calls [ mockGitHubApiRequest . mock . calls . length - 1 ]
369+ expect ( msysComment [ 3 ] ) . toEqual ( '/repos/git-for-windows/msys2-runtime/issues/comments/0' )
370+ expect ( msysComment [ 4 ] ) . toEqual ( {
371+ body : `existing comment body
372+
373+ The workflow run [was started](dispatched-workflow-open-pr.yml)`
374+ } )
375+ } )
376+
333377testIssueComment ( '/updpkgsums' , {
334378 issue : {
335379 number : 104 ,
@@ -504,6 +548,29 @@ The workflow run [was started](dispatched-workflow-build-and-deploy.yml).`)
504548 expect ( dispatchedWorkflows . map ( e => e . payload . inputs . architecture ) ) . toEqual ( [ 'x86_64' ] )
505549} )
506550
551+ testIssueComment ( '/deploy' , {
552+ issue : {
553+ number : 177 ,
554+ title : 'msys2-runtime: update to 4b3a2e08f545432b62461313082193d6df09b6b8' ,
555+ body : 'This corresponds to https://github.com/git-for-windows/msys2-runtime/pull/70' ,
556+ pull_request : {
557+ html_url : 'https://github.com/git-for-windows/MSYS2-packages/pull/177'
558+ }
559+ } ,
560+ repository : {
561+ name : 'MSYS2-packages'
562+ }
563+ } , async ( context ) => {
564+ expect ( await index ( context , context . req ) ) . toBeUndefined ( )
565+ expect ( context . res . body ) . toEqual ( `I edited the comment: appended-comment-body-existing comment body
566+
567+ The workflow run [was started](dispatched-workflow-build-and-deploy.yml).` )
568+ expect ( mockQueueCheckRun ) . toHaveBeenCalledTimes ( 1 )
569+ expect ( mockUpdateCheckRun ) . toHaveBeenCalledTimes ( 1 )
570+ expect ( dispatchedWorkflows . map ( e => e . payload . inputs . architecture ) ) . toEqual ( [ 'x86_64' ] )
571+ expect ( dispatchedWorkflows . map ( e => e . payload . inputs . package ) ) . toEqual ( [ 'msys2-runtime' ] )
572+ } )
573+
507574testIssueComment ( '/deploy msys2-runtime-3.3' , {
508575 issue : {
509576 number : 96 ,
0 commit comments