Skip to content

Commit

Permalink
feat: include changelog in prerelease comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiphe committed May 31, 2023
1 parent cf669fc commit b14a64d
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions release.config.template.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
const PR_COMMENT_TEMPLATE = `## Test this PR 🧪
- version \`<%= version %>\`
- published at **<% print(date.format('ddd, MMM DD YYYY - HH:mm:ss [GMT]Z')) %>**
- based on <%= gitHead %>
\`\`\`bash
yarn add <%= name %>@<%= channel %>
\`\`\``;

module.exports = {
branches: [
"+([0-9])?(.{+([0-9]),x}).x",
Expand All @@ -24,8 +14,28 @@ module.exports = {
"@semantic-release/npm",
process.env.PRE_RELEASE && [
"decorate-gh-pr/on-release",
{ prepend: false, comment: PR_COMMENT_TEMPLATE },
{
prepend: false,
comment,
},
],
!process.env.PRE_RELEASE && "@semantic-release/github",
].filter(Boolean),
};

function comment({ version, name, date, gitHead, channel, notes }) {
return `
## Test this PR 🧪
- version \`${version}\`
- published at **${date.format("ddd, MMM DD YYYY - HH:mm:ss [GMT]Z")}**
- based on ${gitHead}
\`\`\`bash
yarn add ${name}@${version}
# or yarn add ${name}@${channel}
\`\`\`
## Changelog for ${notes.replace(/^#+ /, "")}
`.trim();
}

0 comments on commit b14a64d

Please sign in to comment.