Allow changelog entry to be overridden by a PR section
Problem
Currently, the changelog entry is generated from the PR title.
However, I often want the changelog entry to be different, typically more detailed and more user-facing. In order to do this nowadays, I need to disable changelog generation via Craft and write the changelings manually.
Solution
I would propose we allow users to add a section to their PRs titled "Changelog Entry". If this section is present, the changelog entry would be generated directly from the text in this section, rather than using the title.
Example
Given PR Title "feat: Add foo function" and description:
Description
Add
foofunction, and add unit tests to thoroughly check all edge cases.Changelog Entry
Add a new function called
foowhich prints "Hello, world!"Issues
Closes #XXX
The changelog entry would look like the following (in the "Features" section):
- Add a new function called
foowhich prints "Hello, world!" (#YYY)
@cursoragent implement this
Perfect! I've successfully implemented the feature to allow changelog entries to be overridden by a PR section. Here's a summary of what I've done:
โ Implementation Summary
๐ฏ Core Functionality
Created extractChangelogEntry() function (src/utils/changelog.ts)
- Extracts text from a "Changelog Entry" markdown section in PR descriptions
- Supports both
##and###heading levels - Case-insensitive matching
- Handles multi-line entries with markdown formatting
- Returns
nullif no section is found or if it's empty
Updated changelog generation logic to use custom entries when available:
- Modified the categorized PR processing to check for custom changelog entries
- Modified the "Other" section (leftovers) processing to use custom entries
- Falls back to PR title when no custom entry is found
๐งช Comprehensive Testing
Added 13 unit tests for extractChangelogEntry() covering:
- Various heading formats (##, ###)
- Case insensitivity
- Multi-line entries
- Markdown formatting
- Edge cases (empty sections, no section, null input)
Added 8 integration tests for the full changelog generation flow:
- Using custom changelog entries instead of PR titles
- Fallback to PR title when no custom entry exists
- Mixed scenarios with some PRs having custom entries
- Custom entries in categorized PRs
- Scope preservation with custom entries
- Multi-line custom entries
- Empty changelog entry handling
All 110 tests pass โ
๐ Documentation
Updated README.md with a new section explaining:
- How to use the "Changelog Entry" feature
- Example markdown format
- Behavior and fallback logic
๐ Quality Checks
- โ All tests passing (442 tests total)
- โ Linter passing with no errors
- โ TypeScript compilation successful
- โ Integration with existing changelog generation preserved
The implementation follows the exact specification from the PR description - PR authors can now add a "Changelog Entry" section to their PR descriptions to override the default changelog entry (which uses the PR title) with more detailed, user-facing text.
Learn more about Cursor Agents
This will also be helpful for sentry-dotnet, as we also "craft" (๐) our CHANGELOG.md manually, but run into merge conflicts constantly.