Skip to content

Commit 6a31ce3

Browse files
committed
get-webhook-event-payload: make it easy to start at a given comment
The most common use case for the `get-webhook-event-payload` script is to obtain the record of a failed slash command. To make it easier to use this script, then, accept the URL to the comment in the PR that contains said slash command. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 0660835 commit 6a31ce3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

get-webhook-event-payload.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
while (args.length) {
1212
let option = args.shift()
1313

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+
1424
const optionWithArgument = option.match(/^(--[^=]+)=(.*)$/)
1525
if (optionWithArgument) {
1626
option = optionWithArgument[1]

0 commit comments

Comments
 (0)