Skip to content

Commit

Permalink
Add sender email configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Mar 11, 2020
1 parent 33ca490 commit cfc309b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,6 +48,10 @@ [email protected]

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.
1 change: 1 addition & 0 deletions env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SENDGRID_API_TOKEN=
RECIPIENTS_URL=
SENDER_EMAIL=
GITHUB_EVENT_PATH=
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 4 additions & 2 deletions src/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '[email protected]',
from: {
name: ownerName,
email: '[email protected]',
email: sender,
},
to: sender,
bcc: recipients,
subject,
html: releaseBody,
Expand Down

0 comments on commit cfc309b

Please sign in to comment.