Files
clang-p2996/.github/workflows/issue-subscriber.yml
Tom Stellard dd48c6aff9 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
2022-01-05 10:36:29 -08:00

36 lines
1.1 KiB
YAML

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);
}