read body from file if specified so

This commit is contained in:
Dawid Dziurla 2019-12-06 10:26:00 +01:00
parent 445b6879ac
commit f50066a2fe
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B
3 changed files with 10 additions and 2 deletions

View File

@ -8,6 +8,11 @@ on:
jobs:
main:
runs-on: ubuntu-latest
strategy:
matrix:
body:
- README.md
- Test of action completed successfully!
steps:
- name: Checkout
uses: actions/checkout@v1
@ -19,6 +24,6 @@ jobs:
username: ${{secrets.USERNAME}}
password: ${{secrets.PASSWORD}}
subject: ${{github.repository}}
body: Test of action completed successfully!
body: ${{matrix.body}}
to: ${{secrets.USERNAME}}
from: github-actions

View File

@ -21,7 +21,7 @@ inputs:
description: Subject of mail message
required: true
body:
description: Body of mail message
description: Body of mail message (might be a filename to read from)
required: true
to:
description: Recipients mail addresses (separated with comma)

View File

@ -13,6 +13,9 @@ body = ENV['INPUT_BODY']
to = ENV['INPUT_TO']
from = ENV['INPUT_FROM']
# Body
body = File.exist?(body) ? File.read(body) : body
# Message
message = <<~END_OF_MESSAGE
Subject: #{subject}