craft icon indicating copy to clipboard operation
craft copied to clipboard

Allow changelog entry to be overridden by a PR section

Open szokeasaurusrex opened this issue 1 month ago โ€ข 3 comments

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 foo function, and add unit tests to thoroughly check all edge cases.

Changelog Entry

Add a new function called foo which prints "Hello, world!"

Issues

Closes #XXX

The changelog entry would look like the following (in the "Features" section):

  • Add a new function called foo which prints "Hello, world!" (#YYY)

szokeasaurusrex avatar Dec 04 '25 15:12 szokeasaurusrex

@cursoragent implement this

szokeasaurusrex avatar Dec 04 '25 15:12 szokeasaurusrex

Create PR

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 null if 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.


Open in Cursorย Open in Web

Learn more about Cursor Agents

cursor[bot] avatar Dec 04 '25 15:12 cursor[bot]

This will also be helpful for sentry-dotnet, as we also "craft" (๐Ÿ˜‰) our CHANGELOG.md manually, but run into merge conflicts constantly.

Flash0ver avatar Dec 04 '25 15:12 Flash0ver