1 name: LLVM Bugs notifier
10 runs-on: ubuntu-latest
12 - uses: actions/setup-node@v2
15 - run: npm install mailgun.js form-data
16 - name: Send notification
17 uses: actions/github-script@v5
19 MAILGUN_API_KEY: ${{ secrets.LLVM_BUGS_KEY }}
22 const Mailgun = require('mailgun.js');
23 const formData = require('form-data');
25 const mailgun = new Mailgun(formData);
26 const DOMAIN = 'email.llvm.org';
28 const mg = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY });
30 github.rest.issues.get({
31 issue_number: context.issue.number,
32 owner: context.repo.owner,
33 repo: context.repo.repo
37 author : issue.data.user.login,
38 issue : issue.data.number,
39 title : issue.data.title,
40 url : issue.data.html_url,
41 labels : issue.data.labels.map((label) => label.name),
42 assignee : issue.data.assignees.map((assignee) => assignee.login),
43 body : issue.data.body
47 from: 'LLVM Bugs <llvm-bugs@email.llvm.org>',
48 to: 'llvm-bugs@lists.llvm.org',
49 subject: `[Bug ${issue.data.number}] ${issue.data.title}`,
50 template: 'new-github-issue',
51 'o:tracking-clicks': 'no',
52 'h:X-Mailgun-Variables': JSON.stringify(payload)
55 return mg.messages.create(DOMAIN, data);
57 .then((msg) => console.log(msg));