summaryrefslogtreecommitdiffstats
path: root/.github/workflows/new-bugs-announce-notifier.yml
diff options
context:
space:
mode:
authorEe Durbin <ewdurbin@gmail.com>2022-04-10 17:48:53 (GMT)
committerGitHub <noreply@github.com>2022-04-10 17:48:53 (GMT)
commit9263c8691c34ef05056a4146b16c683e603e2999 (patch)
tree42587a730c9b8da797efcc02e897071d9eb2d02b /.github/workflows/new-bugs-announce-notifier.yml
parentdefbbd68f7f68f4edb3a6b256f26e0532727b3da (diff)
downloadcpython-9263c8691c34ef05056a4146b16c683e603e2999.zip
cpython-9263c8691c34ef05056a4146b16c683e603e2999.tar.gz
cpython-9263c8691c34ef05056a4146b16c683e603e2999.tar.bz2
notify new-bugs-announce on new issue open (#32421)
Diffstat (limited to '.github/workflows/new-bugs-announce-notifier.yml')
-rw-r--r--.github/workflows/new-bugs-announce-notifier.yml53
1 files changed, 53 insertions, 0 deletions
diff --git a/.github/workflows/new-bugs-announce-notifier.yml b/.github/workflows/new-bugs-announce-notifier.yml
new file mode 100644
index 0000000..a189463
--- /dev/null
+++ b/.github/workflows/new-bugs-announce-notifier.yml
@@ -0,0 +1,53 @@
+name: new-bugs-announce notifier
+
+on:
+ issues:
+ types:
+ - opened
+
+jobs:
+ notify-new-bugs-announce:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/setup-node@v2
+ with:
+ node-version: 14
+ - run: npm install mailgun.js form-data
+ - name: Send notification
+ uses: actions/github-script@v5
+ env:
+ MAILGUN_API_KEY: ${{ secrets.PSF_MAILGUN_KEY }}
+ with:
+ script: |
+ const Mailgun = require("mailgun.js");
+ const formData = require('form-data');
+ const mailgun = new Mailgun(formData);
+ const DOMAIN = "mg.python.org";
+ const mg = mailgun.client({username: 'api', key: process.env.MAILGUN_API_KEY});
+ github.rest.issues.get({
+ issue_number: context.issue.number,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ })
+ .then(function(issue) {
+ const payload = {
+ author : issue.data.user.login,
+ issue : issue.data.number,
+ title : issue.data.title,
+ url : issue.data.html_url,
+ labels : issue.data.labels.map(label => { return label.name }).join(", "),
+ assignee : issue.data.assignees.map(assignee => { return assignee.login }),
+ body : issue.data.body
+ };
+
+ const data = {
+ from: "CPython Issues <github@mg.python.org>",
+ to: "new-bugs-announce@python.org",
+ subject: `[Issue ${issue.data.number}] ${issue.data.title}`,
+ template: "new-github-issue",
+ 'o:tracking-clicks': 'no',
+ 'h:X-Mailgun-Variables': JSON.stringify(payload)
+ };
+ return mg.messages.create(DOMAIN, data)
+ })
+ .then(msg => console.log(msg));