- add npm workflow to fetch recent Jira issues, summarize them, and create a target Jira ticket - generate HTML report and optional SMTP email output - add Docker runtime and TeamCity runner scripts (sh/ps1) - support optional SOLUTION_VERSION, XRAY_REPORT_URL, SONAR_REPORT_URL - map SOLUTION_VERSION to Jira fixVersions on ticket creation - update README and .env.example with new configuration
45 lines
962 B
JavaScript
45 lines
962 B
JavaScript
const nodemailer = require("nodemailer");
|
|
|
|
async function sendReportMail({ smtpConfig, subject, html, text }) {
|
|
if (!smtpConfig.enabled) {
|
|
return { skipped: true, reason: "SMTP_ENABLED=false" };
|
|
}
|
|
|
|
if (
|
|
!smtpConfig.host ||
|
|
!smtpConfig.port ||
|
|
!smtpConfig.user ||
|
|
!smtpConfig.pass ||
|
|
!smtpConfig.from ||
|
|
smtpConfig.to.length === 0
|
|
) {
|
|
throw new Error(
|
|
"SMTP ist aktiviert, aber SMTP_HOST/PORT/USER/PASS/FROM/TO sind nicht vollstaendig gesetzt."
|
|
);
|
|
}
|
|
|
|
const transport = nodemailer.createTransport({
|
|
host: smtpConfig.host,
|
|
port: smtpConfig.port,
|
|
secure: smtpConfig.secure,
|
|
auth: {
|
|
user: smtpConfig.user,
|
|
pass: smtpConfig.pass,
|
|
},
|
|
});
|
|
|
|
const info = await transport.sendMail({
|
|
from: smtpConfig.from,
|
|
to: smtpConfig.to.join(", "),
|
|
subject,
|
|
text,
|
|
html,
|
|
});
|
|
|
|
return { skipped: false, messageId: info.messageId };
|
|
}
|
|
|
|
module.exports = {
|
|
sendReportMail,
|
|
};
|