Skip to content

Commit c4d5de9

Browse files
authored
Merge pull request #83 from dscho/fix-updpkgsums
Fix `/updpkgsums`
2 parents 1f7ced2 + bd8d28a commit c4d5de9

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

GitForWindowsHelper/slash-commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ module.exports = async (context, req) => {
124124
'updpkgsums.yml',
125125
'main', {
126126
repo,
127-
'pr-number': issueNumber,
127+
'pr-number': '' + issueNumber,
128128
actor: commenter
129129
}
130130
);

__tests__/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ The workflow run [was started](dispatched-workflow-updpkgsums.yml).`,
354354
expect(mockGetInstallationAccessToken).toHaveBeenCalledTimes(1)
355355
expect(mockGitHubApiRequestAsApp).not.toHaveBeenCalled()
356356
expect(dispatchedWorkflows).toHaveLength(1)
357-
expect(dispatchedWorkflows.map(e => e.payload.inputs['pr-number'])).toEqual([104])
357+
expect(dispatchedWorkflows.map(e => e.payload.inputs['pr-number'])).toEqual(['104'])
358358
expect(mockGitHubApiRequest).toHaveBeenCalled()
359359
const comment = mockGitHubApiRequest.mock.calls[mockGitHubApiRequest.mock.calls.length - 1]
360360
expect(comment[3]).toEqual('/repos/git-for-windows/MINGW-packages/issues/comments/0')

get-webhook-event-payload.js

100644100755
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env node
2+
13
(async () => {
24
const fs = require('fs')
35

@@ -9,6 +11,16 @@
911
while (args.length) {
1012
let option = args.shift()
1113

14+
const issueCommentMatch = option.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/\d+#issuecomment-(\d+)$/)
15+
if (issueCommentMatch) {
16+
eventType = 'issue_comment'
17+
const githubRequest = require('./GitForWindowsHelper/github-api-request')
18+
const [owner, repo, comment_id] = issueCommentMatch.slice(1)
19+
const comment = await githubRequest(console, null, 'GET', `/repos/${owner}/${repo}/issues/comments/${comment_id}`)
20+
aroundDate = new Date(comment.updated_at)
21+
continue
22+
}
23+
1224
const optionWithArgument = option.match(/^(--[^=]+)=(.*)$/)
1325
if (optionWithArgument) {
1426
option = optionWithArgument[1]

0 commit comments

Comments
 (0)