mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-06-23 00:56:03 +07:00
require file:// prefix in body if loading a file
This commit is contained in:
@@ -11,7 +11,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
body:
|
||||
- README.md
|
||||
- file://README.md
|
||||
- Test of action completed successfully!
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
@@ -13,10 +13,10 @@ An action that simply sends a mail to multiple recipients.
|
||||
username: ${{secrets.MAIL_USERNAME}}
|
||||
password: ${{secrets.MAIL_PASSWORD}}
|
||||
subject: Github Actions job result
|
||||
# Literal body
|
||||
# Literal body:
|
||||
body: Build job of ${{github.repository}} completed successfully!
|
||||
# Read file contents as body:
|
||||
body: README.md
|
||||
body: file://README.md
|
||||
to: obiwan@tatooine.com,yoda@dagobah.com
|
||||
from: Luke Skywalker
|
||||
```
|
||||
|
||||
@@ -14,7 +14,13 @@ to = ENV['INPUT_TO']
|
||||
from = ENV['INPUT_FROM']
|
||||
|
||||
# Body
|
||||
body = File.exist?(body) ? File.read(body) : body
|
||||
prefix = 'file://'
|
||||
body = if body.start_with?(prefix)
|
||||
path = body.delete_prefix(prefix)
|
||||
File.read(path)
|
||||
else
|
||||
body
|
||||
end
|
||||
|
||||
# Message
|
||||
message = <<~END_OF_MESSAGE
|
||||
|
||||
Reference in New Issue
Block a user