-
Notifications
You must be signed in to change notification settings - Fork 4
feat: implement custom semantic release configuration with enhanced changelog and comments #51
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: pawcoding <[email protected]>
.github/semantic-release.md
Outdated
| **For Pre-releases:** | ||
|
|
||
| ``` | ||
| 🎉 This issue is included in version X.X.X-next.X which is now available for testing! 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 🎉 This issue is included in version X.X.X-next.X which is now available for testing! 🚀 | |
| 🎉 This issue is included in version X.X.X-next.X which is now available for testing! 🧪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the documentation with the suggested change. The issue comment template now uses the test tube emoji (🧪) instead of rocket emoji. Commit: b4b4a0b
.github/semantic-release.md
Outdated
| 📦 NPM: [email protected] | ||
| 📖 GitHub Release: X.X.X-next.X | ||
| @username Would you mind testing this fix in your project and letting us know if it works as expected? We'd love your feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @username Would you mind testing this fix in your project and letting us know if it works as expected? We'd love your feedback! | |
| @username Can you check if everything works as expected in your project with this new version? Any feedback is welcome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the documentation with the suggested wording change for asking users to test the fix. Commit: b4b4a0b
.github/semantic-release.md
Outdated
| @username Would you mind testing this fix in your project and letting us know if it works as expected? We'd love your feedback! | ||
| This change will be included in the next regular release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This change will be included in the next regular release. | |
| <small>This change will be included in the next regular release.</small> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the documentation to use <small> tags around the "This change will be included in the next regular release" text. Commit: b4b4a0b
.github/semantic-release.md
Outdated
| **For Pre-releases:** | ||
|
|
||
| ``` | ||
| 🎉 This PR is included in version X.X.X-next.X which is now available for testing! 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 🎉 This PR is included in version X.X.X-next.X which is now available for testing! 🚀 | |
| 🎉 This PR is included in version X.X.X-next.X which is now available for testing! 🧪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the documentation with the suggested change. The PR comment template now uses the test tube emoji (🧪) instead of rocket emoji. Commit: b4b4a0b
.github/semantic-release.md
Outdated
| 📦 NPM: [email protected] | ||
| 📖 GitHub Release: X.X.X-next.X | ||
| @username Thank you for your contribution! This PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @username Thank you for your contribution! This PR | |
| @username Thank you for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the documentation with the cleaner PR comment template. Commit: b4b4a0b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just from looking at these templates I cannot quite imagine how a changelog entry would look. Can you create an example for this PR: #48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release.config.cjs
Outdated
| successComment: `<% if (nextRelease.channel) { %>:tada: This <%= issue.pull_request ? 'PR' : 'issue' %> is included in version <%= nextRelease.version %> which is now available for testing! :rocket: | ||
| 📦 **NPM:** [\`<%= package.name %>@<%= nextRelease.version %>\`](https://www.npmjs.com/package/<%= package.name %>/v/<%= nextRelease.version %>) | ||
| 📖 **GitHub Release:** [<%= nextRelease.version %>](<%= releases[0].url %>) | ||
| <%= issue.pull_request ? '@' + issue.pull_request.user.login : '@' + issue.user.login %> <%= issue.pull_request ? 'Thank you for your contribution! This PR' : 'Would you mind testing this fix in your project and letting us know if it works as expected? We\\'d love your feedback!' %> | ||
| This change will be included in the next regular release.<% } else { %>:tada: This <%= issue.pull_request ? 'PR' : 'issue' %> is included in version <%= nextRelease.version %> which is now available! :rocket: | ||
| 📦 **NPM:** [\`<%= package.name %>@<%= nextRelease.version %>\`](https://www.npmjs.com/package/<%= package.name %>/v/<%= nextRelease.version %>) | ||
| 📖 **GitHub Release:** [<%= nextRelease.version %>](<%= releases[0].url %>)<%= issue.pull_request ? '\\n\\nThank you for your contribution!' : '' %><% } %>`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please adjust the comment with the above mentioned changes in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the GitHub comment templates in the release config to match the documentation changes, using test tube emoji and the improved wording. Commit: b4b4a0b
release.config.cjs
Outdated
| 📦 **NPM:** [\`<%= package.name %>@<%= nextRelease.version %>\`](https://www.npmjs.com/package/<%= package.name %>/v/<%= nextRelease.version %>) | ||
| 📖 **GitHub Release:** [<%= nextRelease.version %>](<%= releases[0].url %>)<%= issue.pull_request ? '\\n\\nThank you for your contribution!' : '' %><% } %>`, | ||
| releasedLabels: ["released on @<%= nextRelease.channel || 'latest' %>"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed. The default label is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the releasedLabels configuration option since the default label is sufficient. Commit: b4b4a0b
release.config.cjs
Outdated
| 📦 **NPM:** [\`<%= package.name %>@<%= nextRelease.version %>\`](https://www.npmjs.com/package/<%= package.name %>/v/<%= nextRelease.version %>) | ||
| 📖 **GitHub Release:** [<%= nextRelease.version %>](<%= releases[0].url %>)<%= issue.pull_request ? '\\n\\nThank you for your contribution!' : '' %><% } %>`, | ||
| releasedLabels: ["released on @<%= nextRelease.channel || 'latest' %>"], | ||
| addReleases: "bottom" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this option do? Not sure if it's needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the addReleases configuration option as it wasn't necessary for our use case. Commit: b4b4a0b
release.config.cjs
Outdated
| transform: (commit, context) => { | ||
| const issues = []; | ||
|
|
||
| commit.notes.forEach((note) => { | ||
| note.title = "BREAKING CHANGES"; | ||
| }); | ||
|
|
||
| // Group different commit types under appropriate categories | ||
| if (commit.type === "feat") { | ||
| commit.type = "Features"; | ||
| } else if (commit.type === "fix") { | ||
| commit.type = "Bug Fixes"; | ||
| } else if (commit.type === "docs") { | ||
| commit.type = "Documentation"; | ||
| } else if ( | ||
| ["style", "refactor", "test", "build", "ci", "chore"].includes( | ||
| commit.type | ||
| ) | ||
| ) { | ||
| commit.type = "Internals"; | ||
| } else if (commit.type === "perf") { | ||
| commit.type = "Performance Improvements"; | ||
| } else if (commit.revert) { | ||
| commit.type = "Reverts"; | ||
| } else { | ||
| return; | ||
| } | ||
|
|
||
| if (commit.scope === "*") { | ||
| commit.scope = ""; | ||
| } | ||
|
|
||
| if (typeof commit.hash === "string") { | ||
| commit.shortHash = commit.hash.substring(0, 7); | ||
| } | ||
|
|
||
| if (typeof commit.subject === "string") { | ||
| let url = context.repository | ||
| ? `${context.host}/${context.owner}/${context.repository}` | ||
| : context.repoUrl; | ||
| if (url) { | ||
| url = `${url}/issues/`; | ||
| // Issue URLs. | ||
| commit.subject = commit.subject.replace( | ||
| /#([0-9]+)/g, | ||
| (_, issue) => { | ||
| issues.push(issue); | ||
| return `[#${issue}](${url}${issue})`; | ||
| } | ||
| ); | ||
| } | ||
| if (context.host) { | ||
| // User URLs. | ||
| commit.subject = commit.subject.replace( | ||
| /\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, | ||
| (_, username) => { | ||
| if (username.includes("/")) { | ||
| return `@${username}`; | ||
| } | ||
|
|
||
| return `[@${username}](${context.host}/${username})`; | ||
| } | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| // remove references that already appear in the subject | ||
| commit.references = commit.references.filter((reference) => { | ||
| if (issues.indexOf(reference.issue) === -1) { | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| }); | ||
|
|
||
| return commit; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you extract this function into a separate utility script 😅
The config itself is already hard to read without it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted the large transform function into a separate utility script at .semantic-release/utils/transform-commit.js to improve readability of the main configuration file. The config file is now much cleaner and easier to understand. Commit: b4b4a0b
pawcoding
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please address the above mentioned change requests
…iguration Co-authored-by: pawcoding <[email protected]>
This PR implements a comprehensive custom semantic release configuration that enhances the changelog generation and GitHub interaction experience as requested in the issue.
Key Changes
📖 Enhanced Changelog with Emojis
The changelog now automatically categorizes commits with descriptive emojis and includes contributor information:
featcommits)fixcommits)docscommits)refactor,style,test,build,ci,chorecommits)perfcommits)Each commit entry now includes contributor attribution showing
@usernamefor proper credit.💬 Personalized GitHub Comments
Issue Comments:
PR Comments:
All comments include NPM package links and GitHub release links for easy access.
🏗️ Implementation Details
The implementation uses custom Handlebars templates in
.semantic-release/templates/to control the changelog formatting. The main configuration inrelease.config.cjshas been enhanced with:📚 Documentation
Added comprehensive documentation in
.github/semantic-release.mdexplaining:The implementation maintains full backward compatibility with the existing workflow while providing the enhanced experience requested.
Fixes #50.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.