diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 524162b68..21d2b6a57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: body: - - README.md + - file://README.md - Test of action completed successfully! steps: - name: Checkout diff --git a/README.md b/README.md index 6d1b46664..cd6e09291 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/main.rb b/main.rb index 10901b927..7c0f3c13d 100755 --- a/main.rb +++ b/main.rb @@ -14,7 +14,13 @@ 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