Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 10, 2025

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:

  • Features - New functionality (feat commits)
  • 🩹 Fixes - Bug fixes (fix commits)
  • 📚 Documentation - Documentation updates (docs commits)
  • 🛠️ Internals - Internal changes (refactor, style, test, build, ci, chore commits)
  • Performance - Performance improvements (perf commits)
  • ↩️ Reverts - Reverted changes
  • ⚠️ BREAKING CHANGES - Breaking changes

Each commit entry now includes contributor attribution showing @username for proper credit.

💬 Personalized GitHub Comments

Issue Comments:

  • Pre-releases: Custom message with @mention asking the issue creator for feedback and testing
  • Regular releases: Congratulatory message with relevant links

PR Comments:

  • Pre-releases: Thanks the contributor and mentions the PR is included in the pre-release
  • Regular releases: Thanks the contributor for their contribution

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 in release.config.cjs has been enhanced with:

  • Custom transform functions for commit categorization
  • Template loading for consistent formatting
  • Conditional GitHub comment templates that differentiate between pre-releases and regular releases
  • Proper contributor attribution and issue/PR linking

📚 Documentation

Added comprehensive documentation in .github/semantic-release.md explaining:

  • How the new changelog categories work
  • Examples of issue and PR comment templates
  • Configuration file structure
  • Commit types and their release impact

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.

Copilot AI changed the title [WIP] Custom semantic release configuration feat: implement custom semantic release configuration with enhanced changelog and comments Aug 10, 2025
Copilot AI requested a review from pawcoding August 10, 2025 08:50
**For Pre-releases:**

```
🎉 This issue is included in version X.X.X-next.X which is now available for testing! 🚀
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
🎉 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! 🧪

Copy link
Contributor Author

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

📦 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!
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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.

Copy link
Contributor Author

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

@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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This change will be included in the next regular release.
<small>This change will be included in the next regular release.</small>

Copy link
Contributor Author

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

**For Pre-releases:**

```
🎉 This PR is included in version X.X.X-next.X which is now available for testing! 🚀
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
🎉 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! 🧪

Copy link
Contributor Author

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

📦 NPM: [email protected]
📖 GitHub Release: X.X.X-next.X
@username Thank you for your contribution! This PR
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@username Thank you for your contribution! This PR
@username Thank you for your contribution!

Copy link
Contributor Author

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

Copy link
Owner

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comprehensive example changelog entry for PR #48 in the documentation. The example shows how commits would be categorized into 🩹 Fixes and 🛠️ Internals sections with proper formatting, links, and contributor attribution. Commit: b4b4a0b

Comment on lines 155 to 165
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!' : '' %><% } %>`,
Copy link
Owner

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.

Copy link
Contributor Author

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

📦 **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' %>"],
Copy link
Owner

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.

Copy link
Contributor Author

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

📦 **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"
Copy link
Owner

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.

Copy link
Contributor Author

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

Comment on lines 57 to 133
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;
}
Copy link
Owner

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

Copy link
Contributor Author

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

Copy link
Owner

@pawcoding pawcoding left a 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

Copilot AI requested a review from pawcoding August 10, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom semantic release configuration

2 participants