mirror of
https://github.com/python/cpython.git
synced 2024-11-22 13:28:21 +01:00
f21e2f4b12
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
61 lines
2.2 KiB
YAML
61 lines
2.2 KiB
YAML
name: new-bugs-announce notifier
|
|
|
|
on:
|
|
issues:
|
|
types:
|
|
- opened
|
|
|
|
permissions:
|
|
issues: read
|
|
|
|
jobs:
|
|
notify-new-bugs-announce:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
- run: npm install mailgun.js form-data
|
|
- name: Send notification
|
|
uses: actions/github-script@v7
|
|
env:
|
|
MAILGUN_API_KEY: ${{ secrets.MAILGUN_PYTHON_ORG_MAILGUN_KEY }}
|
|
with:
|
|
script: |
|
|
const Mailgun = require("mailgun.js");
|
|
const formData = require('form-data');
|
|
const mailgun = new Mailgun(formData);
|
|
const DOMAIN = "mailgun.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 }),
|
|
// We need to truncate the body size, because the max size for
|
|
// the whole payload is 16kb. We want to be safe and assume that
|
|
// body can take up to ~8kb of space.
|
|
body : issue.data.body.substring(0, 8000)
|
|
};
|
|
|
|
const data = {
|
|
from: "CPython Issues <github@mailgun.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));
|