Skip to content

Commit 90bea20

Browse files
committed
Allow /deploy to work in MSYS2 runtime PRs in MSYS2-packages
I taught the `open-pr` GitHub workflow to open such PRs in git-for-windows/git-for-windows-automation#87, and now it is time to make `/deploy` work in such PRs. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent f71966a commit 90bea20

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

GitForWindowsHelper/component-updates.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const guessComponentUpdateDetails = (title, body) => {
22
let [ , package_name, version ] =
33
title.match(/^\[New (\S+) version\] (?:[^0-9]+\s+)?(\S+(?:\s+patch\s+\d+)?)(?! new items)/) ||
44
title.match(/^(\S+): update to v?(\d[0-9.]\S*)/) ||
5+
title.match(/^(msys2-runtime): update to ([0-9a-f]{40,64})/) ||
56
body.match(/^# \[New (\S+) version\] (?:[^0-9]+\s+)?(\S+(?:\s+patch\s+\d+)?)/) ||
67
[]
78
if (!package_name || !version) throw new Error(`Could not guess component-update details from title '${title}'`)

__tests__/index.test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ let mockGitHubApiRequest = jest.fn((_context, _token, method, requestPath, paylo
139139
if (method === 'GET' && requestPath.endsWith('/pulls/69')) return {
140140
head: { sha: '59d71150a6ee93ab954221c43ca86f8eafe68ddc'}
141141
}
142+
if (method === 'GET' && requestPath.endsWith('/pulls/177')) return {
143+
head: { sha: '03bdffe5997'}
144+
}
142145
if (method === 'PATCH' && requestPath.endsWith('/git/refs/heads/main')) {
143146
if (payload.sha !== 'c0ffee1ab7e') throw new Error(`Unexpected sha: ${payload.sha}`)
144147
if (payload.force !== false) throw new Error(`Unexpected force value: ${payload.force}`)
@@ -545,6 +548,29 @@ The workflow run [was started](dispatched-workflow-build-and-deploy.yml).`)
545548
expect(dispatchedWorkflows.map(e => e.payload.inputs.architecture)).toEqual(['x86_64'])
546549
})
547550

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+
548574
testIssueComment('/deploy msys2-runtime-3.3', {
549575
issue: {
550576
number: 96,

0 commit comments

Comments
 (0)