From 12aa071adc27f8342d4c3b218355c564d4943f59 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Thu, 28 Mar 2024 10:05:40 +0530 Subject: [PATCH] [meta] Add a special case for comments in the notifier workaround Discord still hasn't fixed the issue on their end, and having a top level link whenever a new comment is added is getting cumbersome, so add a handler for the common comments case too. Tested and deployed. --- infra/workers/github-discord-notifier/src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/infra/workers/github-discord-notifier/src/index.ts b/infra/workers/github-discord-notifier/src/index.ts index 19191d958..4e67c8469 100644 --- a/infra/workers/github-discord-notifier/src/index.ts +++ b/infra/workers/github-discord-notifier/src/index.ts @@ -65,7 +65,10 @@ const handleRequest = async (request: Request, discordWebhookURL: string) => { // arrangement (we shouldn't be getting 429s forever), so just try to // see if we can extract a URL from something we recognize. let activityURL: string | undefined; - if (requestJSON["issue"]) { + if (requestJSON["comment"]) { + activityURL = requestJSON["comment"]["html_url"]; + } + if (!activityURL && requestJSON["issue"]) { activityURL = requestJSON["issue"]["html_url"]; } if (!activityURL && requestJSON["discussion"]) {