diff options
author | Tom Stellard <tstellar@redhat.com> | 2022-01-05 21:30:30 +0300 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2022-01-05 21:36:29 +0300 |
commit | dd48c6aff99233ff46ab08009e26baf3b2ed6f14 (patch) | |
tree | 7d61f0375744cda5f050a024835af4e84a7869c6 /.github | |
parent | 954aaf7c1449e4a3a55345532da98fe3ec8710fa (diff) |
github: Add action for automated issue notification
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.
Differential Revision: https://reviews.llvm.org/D114412
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/issue-subscriber.yml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/.github/workflows/issue-subscriber.yml b/.github/workflows/issue-subscriber.yml new file mode 100644 index 000000000000..51c55fa362ad --- /dev/null +++ b/.github/workflows/issue-subscriber.yml @@ -0,0 +1,35 @@ +name: Issue Subscriber + +on: + issues: + types: + - labeled + +jobs: + auto-subscribe: + runs-on: ubuntu-latest + if: github.repository == 'llvm/llvm-project' + steps: + - name: Update watchers + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.ISSUE_MENTION_SECRET }} + script: | + const teamname = "issue-subscribers-" + context.payload.label.name.replace(/ /g, "-").replace(":","-").replace("/","-"); + 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); + } |