diff --git a/pkg/changelog/markdown.go b/pkg/changelog/markdown.go index 87cc831..50202a6 100644 --- a/pkg/changelog/markdown.go +++ b/pkg/changelog/markdown.go @@ -45,9 +45,7 @@ func (g *MarkdownGenerator) Generate(commits []convention.Commit) string { nodes = append(nodes, markdown.NewHeader(firstLevel, title)) // version - year, month, day := g.t.Date() - versionHeader := fmt.Sprintf("%s (%d-%d-%d)", g.version, year, month, day) - nodes = append(nodes, markdown.NewHeader(secondLevel, versionHeader)) + nodes = append(nodes, markdown.NewHeader(secondLevel, g.getVersionHeader())) // new nodes = append(nodes, newBases...) @@ -121,3 +119,8 @@ func (g *MarkdownGenerator) getOldNodes() []markdown.Node { return result } + +func (g *MarkdownGenerator) getVersionHeader() string { + year, month, day := g.t.Date() + return fmt.Sprintf("%s (%d-%d-%d)", g.version, year, month, day) +}