mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-24 21:20:40 +00:00
8cf6f1eb56
BREAKING CHANGE: changes commit-log command json, rename subject to description, move all commit message attributes to 'message'
44 lines
942 B
Go
44 lines
942 B
Go
package sv
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/Masterminds/semver/v3"
|
|
)
|
|
|
|
func version(v string) semver.Version {
|
|
r, _ := semver.NewVersion(v)
|
|
return *r
|
|
}
|
|
|
|
func commitlog(t string, metadata map[string]string) GitCommitLog {
|
|
breaking := false
|
|
if _, found := metadata[breakingKey]; found {
|
|
breaking = true
|
|
}
|
|
return GitCommitLog{
|
|
Message: CommitMessage{
|
|
Type: t,
|
|
Description: "subject text",
|
|
IsBreakingChange: breaking,
|
|
Metadata: metadata,
|
|
},
|
|
}
|
|
}
|
|
|
|
func releaseNote(version *semver.Version, date time.Time, sections map[string]ReleaseNoteSection, breakingChanges []string) ReleaseNote {
|
|
return ReleaseNote{
|
|
Version: version,
|
|
Date: date.Truncate(time.Minute),
|
|
Sections: sections,
|
|
BreakingChanges: breakingChanges,
|
|
}
|
|
}
|
|
|
|
func newReleaseNoteSection(name string, items []GitCommitLog) ReleaseNoteSection {
|
|
return ReleaseNoteSection{
|
|
Name: name,
|
|
Items: items,
|
|
}
|
|
}
|