Skip to content

fix(changelog): categorize direct commits (no PR) by commit_patterns#764

Merged
BYK merged 2 commits intomasterfrom
fix/changelog-categorize-commits-without-prs
Feb 27, 2026
Merged

fix(changelog): categorize direct commits (no PR) by commit_patterns#764
BYK merged 2 commits intomasterfrom
fix/changelog-categorize-commits-without-prs

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 27, 2026

Problem

Commits pushed directly without an associated PR were always routed to the Other leftovers section, even when their title matched a category via commit_patterns. The version bump calculation was already correct (bump type is tracked before the leftovers guard), so this was a display-only bug.

Root Cause

In categorizeCommits(), the leftovers guard had an extra || !raw.pr clause:

// Before
if (!categoryTitle || !raw.pr) {

This forced every PR-less commit into leftovers regardless of whether matchCommitToCategory() had already found a match.

Fix

Remove || !raw.pr so only unmatched commits go to leftovers:

// After
if (!categoryTitle) {

No other changes needed — formatChangelogEntry already falls back to commit-hash links when prNumber is falsy, so PR-less entries render correctly in category sections.

Tests

  • Two new tests covering direct commits being categorized by commit_patterns
  • Updated one existing assertion whose expected strings changed (commits now land in Internal Changes instead of Other)

Commits pushed directly without an associated PR were always routed to
the 'Other' leftovers section, even when their title matched a category
via `commit_patterns`. This was caused by an extra `|| !raw.pr` guard
in `categorizeCommits()` that forced any PR-less commit into leftovers
regardless of category match.

Remove the guard so only unmatched commits go to leftovers. The
downstream rendering already handles PR-less entries gracefully:
`createPREntriesFromRaw` uses `raw.pr ?? ''` and `formatChangelogEntry`
falls back to commit-hash links when `prNumber` is falsy.

The version bump calculation was not affected — it tracks bump type
before the leftovers check — so this is a display-only fix.
@BYK BYK marked this pull request as ready for review February 27, 2026 19:16
@BYK BYK merged commit 7580808 into master Feb 27, 2026
17 checks passed
@BYK BYK deleted the fix/changelog-categorize-commits-without-prs branch February 27, 2026 19:31
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.

1 participant