This commit is contained in:
Tim Taubert 2017-06-16 11:26:48 +02:00
Родитель 73260891f3
Коммит 26519cea4b
2 изменённых файлов: 0 добавлений и 41 удалений

Просмотреть файл

@ -1,29 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import postmark_ from "postmark";
const postmark = postmark_(process.env.POSTMARK_API_TOKEN);
const FROM = "NSS Taskcluster <nss-tc@timtaubert.de>";
async function send(recipients, subject, body) {
let addresses = recipients.map(recipient => {
if (recipient.email) {
return `"${recipient.name || recipient.email}" <${recipient.email}>`;
}
}).filter(x => x);
if (!addresses.length) {
return;
}
postmark.send({
From: FROM,
To: addresses.join(", "),
Subject: subject,
TextBody: body
});
}
module.exports.send = send;

Просмотреть файл

@ -5,7 +5,6 @@
import hg from "./hg"; import hg from "./hg";
import irc from "./irc"; import irc from "./irc";
import tcc from "./tcc"; import tcc from "./tcc";
import email from "./email";
import colors from "irc-colors"; import colors from "irc-colors";
import unique from "array-unique"; import unique from "array-unique";
@ -95,17 +94,6 @@ tcc.onTaskFailed(async function (msg) {
let blame = unique(authors.map(author => author.name)).join(", "); let blame = unique(authors.map(author => author.name)).join(", ");
irc.say(`[${level}] ${url}${task.metadata.name} @ ${platform} ${collection} (blame: ${blame})`); irc.say(`[${level}] ${url}${task.metadata.name} @ ${platform} ${collection} (blame: ${blame})`);
// Build descriptions.
let descriptions = changesets.map(changeset => {
return `${changeset.author.name}${changeset.desc}\n${changeset.href}`;
});
// Send emails.
email.send(authors,
`[NSS Taskcluster] ${task.metadata.name} FAILING on ${platform} ${collection} @ ${revision}`,
`${task.metadata.name} @ ${platform} ${collection}\n` +
`${url}\n\n${descriptions.join("\n\n")}`);
}); });
// Join ASAP. // Join ASAP.