mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 13:21:00 +00:00
The forge ui usually shows the release name right above the description, so this removes an unecessary duplicate bit of information. In addition this also cleans up the changelog interface a bit and moves functionality where it belongs. Prepares a bit for custom changelogs in the future. Closes #32
32 lines
673 B
Go
32 lines
673 B
Go
package commitparser
|
|
|
|
import (
|
|
"github.com/apricote/releaser-pleaser/internal/git"
|
|
)
|
|
|
|
type CommitParser interface {
|
|
Analyze(commits []git.Commit) ([]AnalyzedCommit, error)
|
|
}
|
|
|
|
type AnalyzedCommit struct {
|
|
git.Commit
|
|
Type string
|
|
Description string
|
|
Scope *string
|
|
BreakingChange bool
|
|
}
|
|
|
|
// ByType groups the Commits by the type field. Used by the Changelog.
|
|
func ByType(in []AnalyzedCommit) map[string][]AnalyzedCommit {
|
|
out := map[string][]AnalyzedCommit{}
|
|
|
|
for _, commit := range in {
|
|
if out[commit.Type] == nil {
|
|
out[commit.Type] = make([]AnalyzedCommit, 0, 1)
|
|
}
|
|
|
|
out[commit.Type] = append(out[commit.Type], commit)
|
|
}
|
|
|
|
return out
|
|
}
|