JetBrains / gradle-changelog-plugin

Plugin for parsing and managing the Changelog in a "keep a changelog" style.
Apache License 2.0
269 stars 42 forks source link

Format of existing headers in changelog is modified. #149

Open ChrisCarini opened 1 year ago

ChrisCarini commented 1 year ago

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: https://github.com/JetBrains/gradle-changelog-plugin/pull/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:

ChrisCarini commented 1 year ago

Oh, also confirmed that this does not happen for me when I revert to an older version of this plugin, specifically version 1.3.1.

ChrisCarini commented 1 year ago

@hsz or @YannCebron - mind taking a peak at this and the associated failing PR when you have a moment please?

hsz commented 1 year ago

Basically, the square brackets are added to the header (they surround the version part) only when there's a repositoryUrl provided, so section URLs are generated.

daniagudelos commented 9 months ago

It is my intention to have versions that look like the expected behavior described by @ChrisCarini

Basically, the square brackets are added to the header (they surround the version part) only when there's a repositoryUrl provided, so section URLs are generated.

Does your comment mean that the plugin can not be configured as follows?

header.set("[${version.get()}] - $curDate")

It would be my expectation as well to keep the format as configured.

fan-tom commented 2 months ago

Basically, the square brackets are added to the header (they surround the version part) only when there's a repositoryUrl provided, so section URLs are generated.

Can we please not modify the behavior of version property this way, as e.g. I use my own format where I just need version always be what my regex parsed (for existing entries) or what's configured in the provider (for the unreleased version)