Skip to content

Commit

Permalink
Made "to" optional (incase cc or bcc is provided) (#183)
Browse files Browse the repository at this point in the history
* Added made to optional (incase cc or bcc is provided)

* updated action.yml
  • Loading branch information
Legedith committed Sep 27, 2023
1 parent e3f3ba4 commit 4847681
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inputs:
required: true
to:
description: Recipients mail addresses (separated with comma)
required: true
required: false
from:
description: Full name of mail sender (might be with an email address specified in <>)
required: true
Expand Down
7 changes: 6 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function main() {

const subject = core.getInput("subject", { required: true })
const from = core.getInput("from", { required: true })
const to = core.getInput("to", { required: true })
const to = core.getInput("to", { required: false })
const body = core.getInput("body", { required: false })
const htmlBody = core.getInput("html_body", { required: false })
const cc = core.getInput("cc", { required: false })
Expand All @@ -92,6 +92,11 @@ async function main() {
const ignoreCert = core.getInput("ignore_cert", { required: false })
const priority = core.getInput("priority", { required: false })

// if neither to, cc or bcc is provided, throw error
if (!to && !cc && !bcc) {
throw new Error("At least one of 'to', 'cc' or 'bcc' must be specified")
}

if (!serverAddress) {
throw new Error("Server address must be specified")
}
Expand Down

0 comments on commit 4847681

Please sign in to comment.