fix: empty CHANGELOG title when no new commits
parent
2c83e5c50b
commit
c435f22831
|
@ -32,6 +32,10 @@ func NewMarkdownGenerator(path string, version string, t time.Time) *MarkdownGen
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *MarkdownGenerator) Generate(commits []convention.Commit) error {
|
func (g *MarkdownGenerator) Generate(commits []convention.Commit) error {
|
||||||
|
if len(commits) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
lines := g.getLines(commits)
|
lines := g.getLines(commits)
|
||||||
previousLines := g.getPreviousLines()
|
previousLines := g.getPreviousLines()
|
||||||
|
|
||||||
|
@ -45,13 +49,8 @@ func (g *MarkdownGenerator) Generate(commits []convention.Commit) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *MarkdownGenerator) getLines(commits []convention.Commit) []string {
|
func (g *MarkdownGenerator) getLines(commits []convention.Commit) []string {
|
||||||
if len(commits) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
lines := make([]string, 0, defaultLinesLen)
|
lines := make([]string, 0, defaultLinesLen)
|
||||||
lines = append(lines, markdownTitle)
|
lines = append(lines, markdownTitle)
|
||||||
|
|
||||||
lines = append(lines, g.composeVersionHeader())
|
lines = append(lines, g.composeVersionHeader())
|
||||||
|
|
||||||
addedLines := make([]string, 0, defaultLinesLen)
|
addedLines := make([]string, 0, defaultLinesLen)
|
||||||
|
|
Loading…
Reference in New Issue