Skip to content

Commit e7683b4

Browse files
committed
updating version
1 parent f4fe1ef commit e7683b4

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email-release-notification",
3-
"version": "3.0.1",
3+
"version": "4.0.0",
44
"description": "MailGun GitHub Notify Action",
55
"contributors": [
66
{

src/notify.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
const fs = require('fs');
22
const axios = require('axios');
33
const showdown = require('showdown');
4-
const Mailgun = require('mailgun.js');
5-
6-
const mailgun = new Mailgun({apiKey: process.env.MAILGUN_API_TOKEN, domain: process.env.MAILGUN_EMAIL_DOMAIN});
4+
const Mailgun = require('mailgun-js');
75

86
async function prepareMessage(recipients, lists) {
97
const { repository, release } = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));
@@ -27,11 +25,11 @@ async function prepareMessage(recipients, lists) {
2725

2826
const sender = process.env.RELEASE_SENDER_EMAIL;
2927

30-
if (releaseRegex == null || new RegExp(releaseRegex).match(releaseVersion) != null) {
28+
if (releaseRegex == null || new RegExp(releaseRegex).test(releaseVersion) != null) {
3129
return {
3230
from: sender,
33-
to: lists,
34-
bcc: recipients,
31+
to: recipients,
32+
bcc: lists,
3533
subject: subject,
3634
html: releaseBody,
3735
};
@@ -43,6 +41,9 @@ async function run(recipientsUrl, distributionLists) {
4341
const { data } = await axios.get(recipientsUrl);
4442
const recipients = data.split(/\r\n|\n|\r/);
4543
const lists = distributionLists ? distributionLists.split(',') : [];
44+
45+
const mailgun = new Mailgun({apiKey: process.env.MAILGUN_API_TOKEN, domain: process.env.MAILGUN_EMAIL_DOMAIN});
46+
4647
const message = await prepareMessage(recipients, lists);
4748
if(message != false) {
4849
await mailgun.messages().send(message, function (err, body) {
@@ -60,7 +61,6 @@ async function run(recipientsUrl, distributionLists) {
6061
/**
6162
* Run
6263
*/
63-
setCredentials();
6464
run(process.env.RELEASE_RECIPIENTS_URL, process.env.RELEASE_DISTRIBUTION_LISTS)
6565
.catch((error) => {
6666
console.error(error);

0 commit comments

Comments
 (0)