From cfc309bcc155097d87cb7513cfedc923075b4ce4 Mon Sep 17 00:00:00 2001 From: Gabriel Omar Cotelli Date: Wed, 11 Mar 2020 14:50:09 -0300 Subject: [PATCH] Add sender email configuration --- README.md | 7 ++++++- env.template | 1 + package-lock.json | 2 +- package.json | 2 +- src/notify.js | 6 ++++-- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6d92905..3e1527c 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Notify about a new release - uses: ba-st-actions/email-release-notification@v2.0.0 + uses: ba-st-actions/email-release-notification@v3.0.0 env: SENDGRID_API_TOKEN: ${{ secrets.SENDGRID_API_TOKEN }} RECIPIENTS_URL: ${{ secrets.RECIPIENTS_URL }} + SENDER_EMAIL: ${{ secrets.SENDER_EMAIL }} ``` ### 2. Set the SendGrid secret @@ -47,6 +48,10 @@ list@example.com If you don't know where to host this file, just go to [GitHub Gists](https://gist.github.com) and create a new textfile with the e-mails you want to target. After you save the file just click `raw` and get the URI of the file you've just created. +### 3. Set the SENDER_EMAIL secret + +Do the same for a secret named `SENDER_EMAIL` including the e-mail to be used in the `from:` field on the mail message. + ### 4. Test the workflow! Create a new release for your repository and verify that the action triggers and that the e-mails were sent. Sometimes it's worth checking the spam inbox. diff --git a/env.template b/env.template index d49462d..bcd6d12 100644 --- a/env.template +++ b/env.template @@ -1,3 +1,4 @@ SENDGRID_API_TOKEN= RECIPIENTS_URL= +SENDER_EMAIL= GITHUB_EVENT_PATH= diff --git a/package-lock.json b/package-lock.json index 4ca3054..018aacd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "email-release-notification", - "version": "2.0.0", + "version": "3.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3ede36f..1c5cb9c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "email-release-notification", - "version": "2.0.0", + "version": "3.0.0", "description": "SendGrid GitHub Notify Action", "author": { "name": "Buenos Aires Smalltalk", diff --git a/src/notify.js b/src/notify.js index 5c58828..a83f4ac 100644 --- a/src/notify.js +++ b/src/notify.js @@ -25,12 +25,14 @@ async function prepareMessage(recipients) { const releaseBody = converter.makeHtml(`${header}\n\n${release.body}${footer}`); + const sender = process.env.SENDER_EMAIL; + return { - to: 'noreply@github.com', from: { name: ownerName, - email: 'notifications@github.com', + email: sender, }, + to: sender, bcc: recipients, subject, html: releaseBody,