Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Dec 27, 2025

Summary

Adds automatic stripping of conventional commit type prefixes from changelog entries. When PRs are grouped into categories (and optionally by scope), the prefix becomes redundant and is now removed by default.

How It Works

This uses named capture groups in commit_patterns:

  • (?<type>...) - The prefix to strip (includes type, scope, and colon)
  • (?<scope>...) - The scope to preserve when not under a scope header
Original Title Scope Header Displayed Title
feat(api): add endpoint Yes (Api) Add endpoint
feat(api): add endpoint No (api) Add endpoint
feat: add endpoint N/A Add endpoint

Changes

  • Updated DEFAULT_RELEASE_CONFIG patterns with named capture groups
  • Added CategoryMatchResult to track matched pattern during categorization
  • Created stripTitle() helper for context-aware title stripping
  • Integrated stripping in serializeChangelog() with scope header context
  • Added 15 tests for stripTitle() functionality
  • Updated documentation

Opt-out

Users can disable stripping by providing custom patterns without named groups:

commit_patterns:
  - "^feat(?:\\([^)]+\\))?!?:"  # No named groups = no stripping

…tries

By default, conventional commit type prefixes (e.g., 'feat(api): ') are now
stripped from changelog entries. The scope is preserved when entries aren't
grouped under a scope header.

This is controlled via named capture groups in commit_patterns:
- (?<type>...) - The prefix to strip
- (?<scope>...) - The scope to preserve when no scope header is shown

Users can disable stripping by using non-capturing groups in their patterns.
@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

Suggested Version Bump

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Changelog

  • Strip commit patterns from changelog entries by @BYK in #674

Other

  • (actions) Make release workflow reusable for external repos by @BYK in #672

Documentation 📚

  • New documentation site! by @BYK in #668

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

PR Preview Action v1.7.2
Preview removed because the pull request was closed.
2025-12-28 09:56 UTC

BYK added 2 commits December 27, 2025 12:41
Previously, 'Other' header for scopeless entries was only shown when there
were scopes with 2+ entries (getting their own header). This caused confusion
when a single unscoped entry appeared after a scope header, looking like it
was part of that scope.

Now 'Other' header is shown whenever there are any scoped entries, except
when scopeless is the only group (where 'Other' would be meaningless).
@BYK BYK changed the title feat(changelog): Strip conventional commit prefixes from changelog entries feat(changelog): Strip commit patterns from changelog entries Dec 27, 2025
BYK added 2 commits December 27, 2025 12:55
When a scope has 2+ entries it gets its own header (e.g., '#### Api').
Single-scope entries and scopeless entries now go under an 'Other'
header to clearly separate them from the grouped scopes.

This prevents confusion where single entries appeared to belong to
the previous scope's header.
- Test that single-scope entries get 'Other' header when scope groups exist
- Test that no 'Other' header when only scopeless entries
- Test that no 'Other' header when all scopes are single-entry
@BYK BYK marked this pull request as ready for review December 27, 2025 10:04
@BYK BYK merged commit f975d1c into master Dec 28, 2025
15 checks passed
@BYK BYK deleted the feat/changelog-title-stripping branch December 28, 2025 09:56
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.

3 participants