Skip to content

Commit

Permalink
fix: remove the 0.0.0 version hack as EasyBuild.PackageReleaseNotes.T…
Browse files Browse the repository at this point in the history
…asks now supports Changelog without versions
  • Loading branch information
MangelMaxime committed Nov 17, 2024
1 parent 0c69cda commit deff564
Showing 1 changed file with 26 additions and 32 deletions.
58 changes: 26 additions & 32 deletions src/Generate/Changelog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
This changelog is generated using [EasyBuild.ChangelogGen](https://github.com/easybuild-org/EasyBuild.ChangelogGen). Do not edit this file manually.
<!-- EasyBuild: START -->
<!-- EasyBuild: END -->
## 0.0.0
<!--
This version is here for programs like [EasyBuild.PackageReleaseNotes.Tasks](https://github.com/easybuild-org/EasyBuild.PackageReleaseNotes.Tasks)
to be able to build your project when working on the first version.
-->
"""

let findVersions (content: string) =
Expand Down Expand Up @@ -150,36 +140,40 @@ let generateNewVersionSection (config: ChangelogGenConfig) (releaseContext: Bump

let groupedCommits = groupCommits Map.empty releaseContext.CommitsForRelease

config.Groups
|> List.iter (fun groupInfo ->
match Map.tryFind groupInfo.Type groupedCommits with
| Some commits ->
appendLine ($"### %s{groupInfo.Group}")
newLine ()
match config.Github with
| Some githubRemote ->
config.Groups
|> List.iter (fun groupInfo ->
match Map.tryFind groupInfo.Type groupedCommits with
| Some commits ->
appendLine ($"### %s{groupInfo.Group}")
newLine ()

for commit in commits do
let githubCommitUrl sha =
$"https://github.com/%s{config.Github.Owner}/%s{config.Github.Repository}/commit/%s{sha}"
for commit in commits do
let githubCommitUrl sha =
$"https://github.com/%s{githubRemote.Owner}/%s{githubRemote.Repository}/commit/%s{sha}"

let commitUrl = githubCommitUrl commit.OriginalCommit.Hash
let commitUrl = githubCommitUrl commit.OriginalCommit.Hash

let description = capitalizeFirstLetter commit.SemanticCommit.Description
let description = capitalizeFirstLetter commit.SemanticCommit.Description

$"* %s{description} ([%s{commit.OriginalCommit.AbbrevHash}](%s{commitUrl}))"
|> appendLine
$"* %s{description} ([%s{commit.OriginalCommit.AbbrevHash}](%s{commitUrl}))"
|> appendLine

let additionalChangelogContent =
tryFindAdditionalChangelogContent commit.SemanticCommit.Body
let additionalChangelogContent =
tryFindAdditionalChangelogContent commit.SemanticCommit.Body

for blockLines in additionalChangelogContent do
appendLine ""
for blockLines in additionalChangelogContent do
appendLine ""

for line in blockLines do
$" %s{line}" |> _.TrimEnd() |> appendLine
for line in blockLines do
$" %s{line}" |> _.TrimEnd() |> appendLine

newLine ()
| None -> () // Can happen if there are no commits for this group
)
newLine ()
| None -> () // Can happen if there are no commits for this group
)

| None -> failwith "Github remote not found"

newVersionLines |> String.concat "\n"

Expand Down

0 comments on commit deff564

Please sign in to comment.