Skip to content

Commit

Permalink
fixes error while sending change-log to slack channel(s) (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
volkanto authored Aug 27, 2021
1 parent 898fb98 commit 5eb215c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
13 changes: 9 additions & 4 deletions bin/assets/slack-post-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
"text": ":warning: Release has been created for {repo}!",
"blocks": [
{
"type": "section",
"type": "header",
"text": {
"type": "mrkdwn",
"text": "<!here> will release `{repo}` soon!"
"type": "plain_text",
"text": ":warning: Release has been created for {repo}!"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":rocket: *{repo} Changelog*"
"text": "<!here> will release `{repo}` soon! :rocket:"
}
},
{
Expand All @@ -31,3 +34,5 @@
}
]
}


4 changes: 3 additions & 1 deletion bin/utils/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@ module.exports = {
tag_name: helper.releaseTagName(tag_name)
});

// if the user terminal supports hyperlink, this will be a clickable link, otherwise prints plain text.
const releaseUrl = prepareReleaseUrl(newRelease.html_url);
spinner.succeed(`Release has been prepared on Github. ${releaseUrl}`);
return releaseUrl;

return newRelease.html_url;

} catch (error) {
let errorMessage = "\n";
Expand Down
7 changes: 6 additions & 1 deletion bin/utils/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ module.exports = {
let templateJson = JSON.parse(templateFile);
let slackMessageTemplate = JSON.stringify(templateJson);

return stringUtils.format(slackMessageTemplate, {repo: repo, changelog: message, releaseUrl: releaseUrl, releaseName: releaseName});
return stringUtils.format(slackMessageTemplate, {
repo: repo,
changelog: message.trim(),
releaseUrl: releaseUrl,
releaseName: releaseName
});
}
}

0 comments on commit 5eb215c

Please sign in to comment.