Skip to content

Commit

Permalink
fix: don't append empty header/footer to changelog (#1918)
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Nov 25, 2020
1 parent a6c4b7e commit 56f3493
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions internal/pipe/changelog/changelog.go
Expand Up @@ -94,15 +94,17 @@ func (Pipe) Run(ctx *context.Context) error {
changelogStringJoiner = " \n"
}

ctx.ReleaseNotes = strings.Join(
[]string{
ctx.ReleaseHeader,
"## Changelog",
strings.Join(entries, changelogStringJoiner),
ctx.ReleaseFooter,
},
"\n\n",
)
changelogElements := []string{
"## Changelog",
strings.Join(entries, changelogStringJoiner),
}
if len(ctx.ReleaseHeader) > 0 {
changelogElements = append([]string{ctx.ReleaseHeader}, changelogElements...)
}
if len(ctx.ReleaseFooter) > 0 {
changelogElements = append(changelogElements, ctx.ReleaseFooter)
}
ctx.ReleaseNotes = strings.Join(changelogElements, "\n\n")

var path = filepath.Join(ctx.Config.Dist, "CHANGELOG.md")
log.WithField("changelog", path).Info("writing")
Expand Down

1 comment on commit 56f3493

@vercel
Copy link

@vercel vercel bot commented on 56f3493 Nov 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.