fix(changelog): correct get lines and skip generate if no new lines
parent
9857323da0
commit
e374d982f0
|
@ -32,11 +32,11 @@ func NewMarkdownGenerator(path string, version string, t time.Time) *MarkdownGen
|
|||
}
|
||||
|
||||
func (g *MarkdownGenerator) Generate(commits []convention.Commit) error {
|
||||
if len(commits) == 0 {
|
||||
lines := g.getLines(commits)
|
||||
if len(lines) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
lines := g.getLines(commits)
|
||||
previousLines := g.getPreviousLines()
|
||||
|
||||
lines = append(lines, previousLines...)
|
||||
|
@ -49,6 +49,10 @@ func (g *MarkdownGenerator) Generate(commits []convention.Commit) error {
|
|||
}
|
||||
|
||||
func (g *MarkdownGenerator) getLines(commits []convention.Commit) []string {
|
||||
if len(commits) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
lines := make([]string, 0, defaultLinesLen)
|
||||
lines = append(lines, markdownTitle)
|
||||
lines = append(lines, g.composeVersionHeader())
|
||||
|
|
Loading…
Reference in New Issue