From f50066a2fec77f5f15dcf5d82842814688595440 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Fri, 6 Dec 2019 10:26:00 +0100 Subject: [PATCH] read body from file if specified so --- .github/workflows/test.yml | 7 ++++++- action.yml | 2 +- main.rb | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 834bc9a..524162b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 \ No newline at end of file diff --git a/action.yml b/action.yml index 98e41e4..b4614a5 100644 --- a/action.yml +++ b/action.yml @@ -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) diff --git a/main.rb b/main.rb index bf1f801..10901b9 100755 --- a/main.rb +++ b/main.rb @@ -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}