feat(analyzer): update AnalyzedCommit to add flexibility in parsing a message

This provides flexibility of parsing and rendering structured messages
with more detail in the changelog and helps extract metadata from the 
message. The new structure can be used to split a message in multiple 
blocks (e.g. footer)
This commit is contained in:
maulik13
2021-02-16 15:25:34 +01:00
committed by Felix Wiedmann
parent 81bdb68ee4
commit dc4d1c581a
13 changed files with 284 additions and 41 deletions

View File

@@ -13,6 +13,11 @@ const (
DefaultTagPrefix = "v"
)
// AnalyzerConfig struct
type AnalyzerConfig struct {
BlockPrefixes []string `yaml:"blockPrefixes"`
}
// ChangelogConfig struct
type ChangelogConfig struct {
PrintAll bool `yaml:"printAll,omitempty"`
@@ -83,6 +88,7 @@ type Checksum struct {
type ReleaseConfig struct {
CommitFormat string `yaml:"commitFormat"`
Branch map[string]string `yaml:"branch"`
Analyzer AnalyzerConfig `yaml:"analyzer"`
Changelog ChangelogConfig `yaml:"changelog,omitempty"`
Release string `yaml:"release,omitempty"`
GitHubProvider GitHubProvider `yaml:"github,omitempty"`

View File

@@ -100,6 +100,7 @@ github:
Compress: false}},
ReleaseTitle: "go-semantic-release release",
IsPreRelease: false,
Analyzer: config.AnalyzerConfig{BlockPrefixes: []string{}},
}, result)
}

View File

@@ -39,7 +39,7 @@ func New(c *config.ReleaseConfig, repository string, checkConfig bool) (*Semanti
return nil, err
}
analyzer, err := analyzer.New(c.CommitFormat, c.Changelog)
analyzer, err := analyzer.New(c.CommitFormat, c.Analyzer, c.Changelog)
if err != nil {
return nil, err
}