Skip to content

Commit

Permalink
Merge pull request #83 from dscho/fix-updpkgsums
Browse files Browse the repository at this point in the history
Fix `/updpkgsums`
  • Loading branch information
dscho authored Jun 8, 2024
2 parents 1f7ced2 + bd8d28a commit c4d5de9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GitForWindowsHelper/slash-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module.exports = async (context, req) => {
'updpkgsums.yml',
'main', {
repo,
'pr-number': issueNumber,
'pr-number': '' + issueNumber,
actor: commenter
}
);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ The workflow run [was started](dispatched-workflow-updpkgsums.yml).`,
expect(mockGetInstallationAccessToken).toHaveBeenCalledTimes(1)
expect(mockGitHubApiRequestAsApp).not.toHaveBeenCalled()
expect(dispatchedWorkflows).toHaveLength(1)
expect(dispatchedWorkflows.map(e => e.payload.inputs['pr-number'])).toEqual([104])
expect(dispatchedWorkflows.map(e => e.payload.inputs['pr-number'])).toEqual(['104'])
expect(mockGitHubApiRequest).toHaveBeenCalled()
const comment = mockGitHubApiRequest.mock.calls[mockGitHubApiRequest.mock.calls.length - 1]
expect(comment[3]).toEqual('/repos/git-for-windows/MINGW-packages/issues/comments/0')
Expand Down
12 changes: 12 additions & 0 deletions get-webhook-event-payload.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

(async () => {
const fs = require('fs')

Expand All @@ -9,6 +11,16 @@
while (args.length) {
let option = args.shift()

const issueCommentMatch = option.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/\d+#issuecomment-(\d+)$/)
if (issueCommentMatch) {
eventType = 'issue_comment'
const githubRequest = require('./GitForWindowsHelper/github-api-request')
const [owner, repo, comment_id] = issueCommentMatch.slice(1)
const comment = await githubRequest(console, null, 'GET', `/repos/${owner}/${repo}/issues/comments/${comment_id}`)
aroundDate = new Date(comment.updated_at)
continue
}

const optionWithArgument = option.match(/^(--[^=]+)=(.*)$/)
if (optionWithArgument) {
option = optionWithArgument[1]
Expand Down

0 comments on commit c4d5de9

Please sign in to comment.