Skip to content

Regression: date of last changelog entry is lost #2890

Description

@rmunn

If a changelog has only one entry in it (say, because it's just been created from a template) then Changelog.LatestEntry will contain Date = None even if there was a date in the changelog. This is likely to cause build scripts to fail; for example, the default build script from https://github.com/TheAngryByrd/MiniScaffold contains the following logic in the "DotnetPack" target:

let releaseDate = latestEntry.Date.Value.ToString("o")

I believe this regression was introduced by #2779, specifically by these two lines. They call the ChangelogEntry.New overload that takes three parameters, which ends up removing the date from the already-parsed entry. They should be replaced by:

let newLastEntry =
    ChangelogEntry.New(last.AssemblyVersion, last.NuGetVersion, last.Date, last.Description, trueChanges, last.IsYanked)

To reproduce

Put the following into CHANGELOG.md and have Fake.Core.ReleaseNotes parse it:

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2017-03-17
First release

### Added
- This release already has lots of features

[0.1.0]: https://github.com/fsprojects/FAKEreleases/tag/v0.1.0

Then print out Changelog.LatestEntry and you'll see Date = None instead of Date = Some 2017-03-17.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions