-
Notifications
You must be signed in to change notification settings - Fork 43
Description
The --changelog flag is a great feature for updating CHANGELOG.md during version bumps. However, it currently does not handle nested headings, which makes it incompatible with popular changelog formats like Keep a Changelog.
For example, given the following changelog:
## [Unreleased]
### Added
- Very Useful Feature
## [0.0.1] - 2024-11-29
### Added
- Useful FeatureAfter running bump minor --changelog, the result is:
## [Unreleased]
### Added
## [0.1.0] - 2024-11-29
- Very Useful Feature
## [0.0.1] - 2024-11-29
### Added
- Useful FeatureThe new version (0.1.0) is inserted under the nearest heading (### Added) instead of aligning with the heading level of the previous version (##). This disrupts the structure of changelogs that use nested headings for categories (e.g., ### Added, ### Fixed, etc.).
Expected behavior:
The new version should align with the same heading level as the previous version, resulting in:
## [Unreleased]
## [0.1.0] - 2024-11-29
### Added
- Very Useful Feature
## [0.0.1] - 2024-11-29
### Added
- Useful FeatureProposed solution
Instead of inserting the new version under the closest heading, bump should search for the previous version heading at the same level (## in this example) and insert the new version after it. This would make the --changelog flag more compatible with nested heading formats.