Skip to content

Commit

Permalink
Release 4.0.1 with linebreak support
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnc committed Jun 10, 2021
1 parent e7683b4 commit 63b5234
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions 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": "4.0.0",
"version": "4.0.1",
"description": "MailGun GitHub Notify Action",
"contributors": [
{
Expand Down
18 changes: 13 additions & 5 deletions src/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Mailgun = require('mailgun-js');
async function prepareMessage(recipients, lists) {
const { repository, release } = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));

const converter = new showdown.Converter();
const converter = new showdown.Converter({simpleLineBreaks: true});
const repoName = repository.name;
const repoURL = repository.html_url;
const repoDescription = repository.description ? `, ${repository.description.charAt(0).toLowerCase()+repository.description.slice(1)}` : '';
Expand All @@ -25,18 +25,25 @@ async function prepareMessage(recipients, lists) {

const sender = process.env.RELEASE_SENDER_EMAIL;

if (releaseRegex == null || new RegExp(releaseRegex).test(releaseVersion) != null) {
console.log("Regex: " + releaseRegex);
console.log("ReleaseVersion: " + releaseVersion);
if (releaseRegex != null) {
console.log("Match?: " + new RegExp(releaseRegex).test(releaseVersion));
}

if (releaseRegex == null || new RegExp(releaseRegex).test(releaseVersion)) {
return {
from: sender,
to: recipients,
bcc: lists,
subject: subject,
html: releaseBody,
};
} else {
return false;
}
} else {
return false;
}
}

async function run(recipientsUrl, distributionLists) {
const { data } = await axios.get(recipientsUrl);
const recipients = data.split(/\r\n|\n|\r/);
Expand All @@ -53,6 +60,7 @@ async function run(recipientsUrl, distributionLists) {
else {
console.log("Sent!")
console.log(body);
console.log(message);
}
});
}
Expand Down

0 comments on commit 63b5234

Please sign in to comment.