main: use const

This commit is contained in:
Dawid Dziurla 2020-03-01 12:37:11 +01:00
parent 8465ba4d6e
commit 7b4177494b
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

26
main.js
View File

@ -4,8 +4,8 @@ const fs = require("fs")
function get_body(body) { function get_body(body) {
if (body.startsWith("file://")) { if (body.startsWith("file://")) {
body = body.replace("file://", "") const file = body.replace("file://", "")
body = fs.readFileSync(body, "utf8") return fs.readFileSync(file, "utf8")
} }
return body return body
@ -13,17 +13,17 @@ function get_body(body) {
async function main() { async function main() {
try { try {
server_address = core.getInput("server_address", { required: true }) const server_address = core.getInput("server_address", { required: true })
server_port = core.getInput("server_port", { required: true }) const server_port = core.getInput("server_port", { required: true })
username = core.getInput("username", { required: true }) const username = core.getInput("username", { required: true })
password = core.getInput("password", { required: true }) const password = core.getInput("password", { required: true })
subject = core.getInput("subject", { required: true }) const subject = core.getInput("subject", { required: true })
body = core.getInput("body", { required: true }) const body = core.getInput("body", { required: true })
to = core.getInput("to", { required: true }) const to = core.getInput("to", { required: true })
from = core.getInput("from", { required: true }) const from = core.getInput("from", { required: true })
html = core.getInput("html") || "false" const html = core.getInput("html") || "false"
transport = nodemailer.createTransport({ const transport = nodemailer.createTransport({
host: server_address, host: server_address,
port: server_port, port: server_port,
secure: server_port == "465", secure: server_port == "465",
@ -33,7 +33,7 @@ async function main() {
} }
}) })
info = await transport.sendMail({ const info = await transport.sendMail({
from: `"${from}" <${username}>`, from: `"${from}" <${username}>`,
to: to, to: to,
subject: subject, subject: subject,