From d4b4fe8144c28ed0b6c489de2064ba72f090eabb Mon Sep 17 00:00:00 2001 From: Roman Isko Date: Tue, 7 Apr 2020 09:46:19 +0300 Subject: [PATCH] Add possibility to attach a file to mail --- action.yml | 3 +++ main.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/action.yml b/action.yml index 116f0c25..d011e2c1 100644 --- a/action.yml +++ b/action.yml @@ -33,6 +33,9 @@ inputs: description: Content-Type HTTP header (text/html or text/plain) required: false default: text/plain + attach_file: + description: File path that will be added to mail message attachments + required: false runs: using: node12 main: main.js diff --git a/main.js b/main.js index 4ea3b848..4d21a0e4 100644 --- a/main.js +++ b/main.js @@ -30,6 +30,7 @@ async function main() { const to = core.getInput("to", { required: true }) const from = core.getInput("from", { required: true }) const content_type = core.getInput("content_type", { required: true }) + const attach_file = core.getInput("attach_file", { required: false }) const transport = nodemailer.createTransport({ host: server_address, @@ -47,6 +48,9 @@ async function main() { subject: subject, text: content_type != "text/html" ? get_body(body) : undefined, html: content_type == "text/html" ? get_body(body) : undefined, + attachments: { + path: attach_file + } }) console.log(info)