[TOSA] Update TOSA Custom Operator attribute names to align with the spec (#71116)
[llvm-project.git] / .github / workflows / llvm-bugs.yml
blobf592dd6ccd90331cf1338b8ce803faefe56da874
1 name: LLVM Bugs notifier
3 permissions:
4   contents: read
5   issues: read
7 on:
8   issues:
9     types:
10       - opened
12 jobs:
13   auto-subscribe:
14     runs-on: ubuntu-latest
15     if: github.repository == 'llvm/llvm-project'
16     steps:
17       - uses: actions/setup-node@v3
18         with:
19           node-version: 18
20           check-latest: true
21       - run: npm install mailgun.js form-data
22       - name: Send notification
23         uses: actions/github-script@v6
24         env:
25           MAILGUN_API_KEY: ${{ secrets.LLVM_BUGS_KEY }}
26         with:
27           script: |
28             const Mailgun = require('mailgun.js');
29             const formData = require('form-data');
31             const mailgun = new Mailgun(formData);
32             const DOMAIN = 'email.llvm.org';
34             const mg = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY });
36             github.rest.issues.get({
37               issue_number: context.issue.number,
38               owner: context.repo.owner,
39               repo: context.repo.repo
40             })
41             .then((issue) => {
42               const payload = {
43                 author : issue.data.user.login,
44                 issue  : issue.data.number,
45                 title  : issue.data.title,
46                 url    : issue.data.html_url,
47                 labels : issue.data.labels.map((label) => label.name),
48                 assignee : issue.data.assignees.map((assignee) => assignee.login),
49                 body   : issue.data.body
50               };
52               const data = {
53                 from: 'LLVM Bugs <llvm-bugs@email.llvm.org>',
54                 to: 'llvm-bugs@lists.llvm.org',
55                 subject: `[Bug ${issue.data.number}] ${issue.data.title}`,
56                 template: 'new-github-issue',
57                 'o:tracking-clicks': 'no',
58                 'h:X-Mailgun-Variables': JSON.stringify(payload)
59               };
61               return mg.messages.create(DOMAIN, data);
62             })
63             .then((msg) => console.log(msg));