mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2024-11-10 05:51:07 +07:00
require file:// prefix in body if loading a file
This commit is contained in:
parent
ae69498bf4
commit
2f26726c4f
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
body:
|
body:
|
||||||
- README.md
|
- file://README.md
|
||||||
- Test of action completed successfully!
|
- Test of action completed successfully!
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -13,10 +13,10 @@ An action that simply sends a mail to multiple recipients.
|
|||||||
username: ${{secrets.MAIL_USERNAME}}
|
username: ${{secrets.MAIL_USERNAME}}
|
||||||
password: ${{secrets.MAIL_PASSWORD}}
|
password: ${{secrets.MAIL_PASSWORD}}
|
||||||
subject: Github Actions job result
|
subject: Github Actions job result
|
||||||
# Literal body
|
# Literal body:
|
||||||
body: Build job of ${{github.repository}} completed successfully!
|
body: Build job of ${{github.repository}} completed successfully!
|
||||||
# Read file contents as body:
|
# Read file contents as body:
|
||||||
body: README.md
|
body: file://README.md
|
||||||
to: obiwan@tatooine.com,yoda@dagobah.com
|
to: obiwan@tatooine.com,yoda@dagobah.com
|
||||||
from: Luke Skywalker
|
from: Luke Skywalker
|
||||||
```
|
```
|
||||||
|
8
main.rb
8
main.rb
@ -14,7 +14,13 @@ to = ENV['INPUT_TO']
|
|||||||
from = ENV['INPUT_FROM']
|
from = ENV['INPUT_FROM']
|
||||||
|
|
||||||
# Body
|
# 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
|
||||||
message = <<~END_OF_MESSAGE
|
message = <<~END_OF_MESSAGE
|
||||||
|
Loading…
Reference in New Issue
Block a user