Skip to content

Format of existing headers in changelog is modified. #149

@ChrisCarini

Description

@ChrisCarini

Describe the bug

When running patchChangelog task, existing headers change away from the specified format.

I have also confirmed that this happens when adding an assert to an existing test case; draft PR with test case: #150

To Reproduce

Existing CHANGELOG.md

<!-- Keep a Changelog guide -> https://keepachangelog.com -->

# IntelliJ Platform Plugin Template Changelog

## [Unreleased]
### Added

### Changed
- Upgrading IntelliJ from 2022.2.4 to 2022.3.0
- Upgrading IntelliJ from 2022.2 to 2022.2.4

### Deprecated

### Removed

### Fixed

### Security

## [0.2.9] - 2022-07-29
### Changed
- Upgrading IntelliJ to 2022.2

## [0.2.8] - 2022-05-18
### Changed
- Upgrading IntelliJ to 2022.1.1

...

changelog gradle configuration

...
changelog {
    version = properties("pluginVersion")
    header = "[${-> version.get()}] - ${new Date().format('yyyy-MM-dd')}"
}
...

Repro steps:

  1. Run ./gradlew patchChangelog --release-note="FOOBAR"
  2. See new CHANGELOG.md file (actual & expected below)

Actual behavior

<!-- Keep a Changelog guide -> https://keepachangelog.com -->

# IntelliJ Platform Plugin Template Changelog

## Unreleased

### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security

## [0.3.0] - 2022-12-27
FOOBAR

## 0.2.9 - 2022-07-29

### Changed
- Upgrading IntelliJ to 2022.2

## 0.2.8 - 2022-05-18

### Changed
- Upgrading IntelliJ to 2022.1.1

...

(NOTE: Notice the missing [ and ] around the version in the pre-existing headers.)

Expected behavior

<!-- Keep a Changelog guide -> https://keepachangelog.com -->

# IntelliJ Platform Plugin Template Changelog

## Unreleased

### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security

## [0.3.0] - 2022-12-27
FOOBAR

## [0.2.9] - 2022-07-29

### Changed
- Upgrading IntelliJ to 2022.2

## [0.2.8] - 2022-05-18

### Changed
- Upgrading IntelliJ to 2022.1.1

...

Environment:

  • OS: macOS
  • Gradle Changelog Plugin Version: 2.0.0
  • Gradle Version: 7.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions