[PATCH] D114412: github: Add action for automated issue notification

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 20:47:52 PST 2021


tstellar created this revision.
tstellar added a reviewer: asl.
tstellar requested review of this revision.
Herald added a project: LLVM.

This adds a github action that will mention a team called issue-subscribers-$LABEL
whenever a label is added to a bug.  Mentioning the team will automatically
subscribe all team members to the bug.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114412

Files:
  .github/workflows/issue-notifier.yml


Index: .github/workflows/issue-notifier.yml
===================================================================
--- /dev/null
+++ .github/workflows/issue-notifier.yml
@@ -0,0 +1,34 @@
+name: Issue Notifier
+
+on:
+  issues:
+    types:
+      - labeled
+
+jobs:
+  auto-subscribe:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Update watchers
+      uses: actions/github-script at v5
+      with:
+        github-token: ${{ secrets.ISSUE_MENTION_SECRET }}
+        script: |
+            const teamname = "issue-subscribers-" + context.payload.label.name.replace(/ /g, "-");
+            const comment = "@llvm/" + teamname;
+            try {
+              // This will throw an exception if the team does not exist and no
+              // comment will be created.
+              team = await github.rest.teams.getByName({
+                org: context.repo.owner,
+                team_slug: teamname
+              });
+              github.rest.issues.createComment({
+                issue_number: context.issue.number,
+                owner: context.repo.owner,
+                repo: context.repo.repo,
+                body: comment
+              });
+            } catch (e){
+              console.log(e);
+            }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114412.389089.patch
Type: text/x-patch
Size: 1239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211123/ccc123c6/attachment.bin>


More information about the llvm-commits mailing list