Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add Mailgun send email action #1210

Merged
merged 8 commits into from
Mar 31, 2021
Merged

chore: Add Mailgun send email action #1210

merged 8 commits into from
Mar 31, 2021

Conversation

lahirumaramba
Copy link
Member

@lahirumaramba lahirumaramba commented Mar 29, 2021

  • Add GitHub Action to send email using mailgun.js npm module.
  • Update nightly workflow to use the send email action.
  • Add a failing integration test to trigger the email notification workflow (this test will be removed once we confirm the email notifications be working as expected).

@lahirumaramba
Copy link
Member Author

lahirumaramba commented Mar 30, 2021

Note: release:stage is added to trigger the integration tests. Integration tests should fail with the added test in this PR. This new test will trigger the send email workflow once merged to master.

});

let from = core.getInput('from');
const cc = core.getInput('cc');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably do not need cc filed. I am open to remove it and keep this action as simple as possible if we need.

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. A few thoughts for improvement.

.github/actions/send-email/index.js Outdated Show resolved Hide resolved
.github/actions/send-email/index.js Outdated Show resolved Hide resolved
.github/workflows/nightly.yml Outdated Show resolved Hide resolved
@lahirumaramba
Copy link
Member Author

Thanks, @hiranya911!
Used a bit of a lazy approach to validate all the required fields. Kept cc, text, html, as optional. If html is provided and not text the API extracts the text content from the html. Let me know what you think.

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of readability nits. And remember to update the binary every time you push a code change.


function validate(config) {
for (param in config) {
if (['cc', 'text', 'html'].includes(param)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const optionalFields = ['cc', 'text', 'html'];

}
}

function validateParameter(value, name) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validateRequiredParameter

@lahirumaramba
Copy link
Member Author

Thanks @hiranya911! Updated the binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:stage Stage a release candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants