1 name: LLVM Bugs notifier
14 runs-on: ubuntu-latest
15 if: github.repository == 'llvm/llvm-project'
17 - uses: actions/setup-node@v3
21 - run: npm install mailgun.js form-data
22 - name: Send notification
23 uses: actions/github-script@v6
25 MAILGUN_API_KEY: ${{ secrets.LLVM_BUGS_KEY }}
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
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
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)
61 return mg.messages.create(DOMAIN, data);
63 .then((msg) => console.log(msg));