gradle-changelog-plugin icon indicating copy to clipboard operation
gradle-changelog-plugin copied to clipboard

Format of existing headers in changelog is modified.

Open ChrisCarini opened this issue 2 years ago • 5 comments

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:

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

ChrisCarini avatar Dec 27 '22 21:12 ChrisCarini

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 avatar Dec 27 '22 21:12 ChrisCarini

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

ChrisCarini avatar Apr 30 '23 00:04 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.

hsz avatar Jun 01 '23 20:06 hsz

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.

daniagudelos avatar Feb 15 '24 14:02 daniagudelos

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)

fan-tom avatar Aug 24 '24 23:08 fan-tom