浏览代码

[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.
Manav Rathi 1 年之前
父节点
当前提交
12aa071adc
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      infra/workers/github-discord-notifier/src/index.ts

+ 4 - 1
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
         // arrangement (we shouldn't be getting 429s forever), so just try to
         // see if we can extract a URL from something we recognize.
         // see if we can extract a URL from something we recognize.
         let activityURL: string | undefined;
         let activityURL: string | undefined;
-        if (requestJSON["issue"]) {
+        if (requestJSON["comment"]) {
+            activityURL = requestJSON["comment"]["html_url"];
+        }
+        if (!activityURL && requestJSON["issue"]) {
             activityURL = requestJSON["issue"]["html_url"];
             activityURL = requestJSON["issue"]["html_url"];
         }
         }
         if (!activityURL && requestJSON["discussion"]) {
         if (!activityURL && requestJSON["discussion"]) {