Added ability to adjust priority to the mail message (#66) (#67)

* Added ability to adjust priority to the mail message (#66)

Co-authored-by: John Pastore <cbbm142@github.com>
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
This commit is contained in:
cbbm142 2021-07-02 12:33:56 -04:00 committed by GitHub
parent db36373cbe
commit 44663f34dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions

View File

@ -55,3 +55,4 @@ jobs:
from: github-actions
attachments: ${{matrix.attachments}}
convert_markdown: ${{matrix.convert_markdown}}
priority: high

View File

@ -48,6 +48,8 @@ Some features:
convert_markdown: true
# Optional attachments:
attachments: attachments.zip,git.diff,./dist/static/main.js
# Optional priority: 'high', 'normal' (default) or 'low'
priority: low
```
## Troubleshooting

View File

@ -53,6 +53,9 @@ inputs:
attachments:
description: Files that will be added to mail message attachments (separated with comma)
required: false
priority:
description: Set Priority level for the mail message to 'high', 'normal' (default) or 'low'
required: false
runs:
using: node12
main: main.js

View File

@ -47,6 +47,7 @@ async function main() {
const attachments = core.getInput("attachments", { required: false })
const convertMarkdown = core.getInput("convert_markdown", { required: false })
const ignoreCert = core.getInput("ignore_cert", { required: false })
const priority = core.getInput("priority", { required: false })
if (!username || !password) {
core.warning("Username and password not specified. You should only do this if you are using a self-hosted runner to access an on-premise mail server.")
@ -74,7 +75,8 @@ async function main() {
replyTo: replyTo ? replyTo : undefined,
text: body ? getBody(body, false) : undefined,
html: htmlBody ? getBody(htmlBody, convertMarkdown) : undefined,
attachments: attachments ? attachments.split(',').map(f => ({ path: f.trim() })) : undefined
attachments: attachments ? attachments.split(',').map(f => ({ path: f.trim() })) : undefined,
priority: priority ? priority : undefined,
})
} catch (error) {
core.setFailed(error.message)