Documentation ¶
Index ¶
- Constants
- func IsValidVersion(value string) bool
- func ToVersion(value string) (*semver.Version, error)
- type BranchesConfig
- type CommitMessage
- type CommitMessageConfig
- type CommitMessageFooterConfig
- type CommitMessageIssueConfig
- type CommitMessageScopeConfig
- type Git
- type GitCommitLog
- type GitImpl
- func (GitImpl) Branch() string
- func (g GitImpl) Commit(header, body, footer string) error
- func (GitImpl) IsDetached() (bool, error)
- func (g GitImpl) LastTag() string
- func (g GitImpl) Log(lr LogRange) ([]GitCommitLog, error)
- func (g GitImpl) Tag(version semver.Version) (string, error)
- func (g GitImpl) Tags() ([]GitTag, error)
- type GitTag
- type LogRange
- type LogRangeType
- type MessageProcessor
- type MessageProcessorImpl
- func (p MessageProcessorImpl) Enhance(branch string, message string) (string, error)
- func (p MessageProcessorImpl) Format(msg CommitMessage) (string, string, string)
- func (p MessageProcessorImpl) IssueID(branch string) (string, error)
- func (p MessageProcessorImpl) Parse(subject, body string) (CommitMessage, error)
- func (p MessageProcessorImpl) SkipBranch(branch string, detached bool) bool
- func (p MessageProcessorImpl) Validate(message string) error
- func (p MessageProcessorImpl) ValidateDescription(description string) error
- func (p MessageProcessorImpl) ValidateScope(scope string) error
- func (p MessageProcessorImpl) ValidateType(ctype string) error
- type OutputFormatter
- type OutputFormatterImpl
- type ReleaseNote
- type ReleaseNoteBreakingChangeSection
- type ReleaseNoteCommitsSection
- type ReleaseNoteProcessor
- type ReleaseNoteProcessorImpl
- type ReleaseNoteSection
- type ReleaseNotesConfig
- type ReleaseNotesSectionConfig
- type SemVerCommitsProcessor
- type SemVerCommitsProcessorImpl
- type TagConfig
- type VersioningConfig
Constants ¶
const ( // ReleaseNotesSectionTypeCommits ReleaseNotesSectionConfig.SectionType value. ReleaseNotesSectionTypeCommits = "commits" // ReleaseNotesSectionTypeBreakingChanges ReleaseNotesSectionConfig.SectionType value. ReleaseNotesSectionTypeBreakingChanges = "breaking-changes" )
Variables ¶
This section is empty.
Functions ¶
func IsValidVersion ¶ added in v2.6.0
IsValidVersion return true when a version is valid.
Types ¶
type BranchesConfig ¶
type BranchesConfig struct { Prefix string `yaml:"prefix"` Suffix string `yaml:"suffix"` DisableIssue bool `yaml:"disable-issue"` Skip []string `yaml:"skip,flow"` SkipDetached *bool `yaml:"skip-detached"` }
BranchesConfig branches preferences.
type CommitMessage ¶
type CommitMessage struct { Type string `json:"type,omitempty"` Scope string `json:"scope,omitempty"` Description string `json:"description,omitempty"` Body string `json:"body,omitempty"` IsBreakingChange bool `json:"isBreakingChange,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` }
CommitMessage is a message using conventional commits.
func NewCommitMessage ¶
func NewCommitMessage(ctype, scope, description, body, issue, breakingChanges string) CommitMessage
NewCommitMessage commit message constructor.
func (CommitMessage) BreakingMessage ¶
func (m CommitMessage) BreakingMessage() string
BreakingMessage return breaking change message from metadata.
func (CommitMessage) Issue ¶
func (m CommitMessage) Issue() string
Issue return issue from metadata.
type CommitMessageConfig ¶
type CommitMessageConfig struct { Types []string `yaml:"types,flow"` HeaderSelector string `yaml:"header-selector"` Scope CommitMessageScopeConfig `yaml:"scope"` Issue CommitMessageIssueConfig `yaml:"issue"` }
CommitMessageConfig config a commit message.
func (CommitMessageConfig) IssueFooterConfig ¶
func (c CommitMessageConfig) IssueFooterConfig() CommitMessageFooterConfig
IssueFooterConfig config for issue.
type CommitMessageFooterConfig ¶
type CommitMessageFooterConfig struct {}
CommitMessageFooterConfig config footer metadata.
type CommitMessageIssueConfig ¶
type CommitMessageIssueConfig struct {
Regex string `yaml:"regex"`
}
CommitMessageIssueConfig issue preferences.
type CommitMessageScopeConfig ¶
type CommitMessageScopeConfig struct {
Values []string `yaml:"values"`
}
CommitMessageScopeConfig config scope preferences.
type Git ¶
type Git interface { LastTag() string Log(lr LogRange) ([]GitCommitLog, error) Commit(header, body, footer string) error Tag(version semver.Version) (string, error) Tags() ([]GitTag, error) Branch() string IsDetached() (bool, error) }
Git commands.
type GitCommitLog ¶
type GitCommitLog struct { Date string `json:"date,omitempty"` Timestamp int `json:"timestamp,omitempty"` AuthorName string `json:"authorName,omitempty"` Hash string `json:"hash,omitempty"` Message CommitMessage `json:"message,omitempty"` }
GitCommitLog description of a single commit log.
type GitImpl ¶
type GitImpl struct {
// contains filtered or unexported fields
}
GitImpl git command implementation.
func NewGit ¶
func NewGit(messageProcessor MessageProcessor, cfg TagConfig) *GitImpl
NewGit constructor.
func (GitImpl) IsDetached ¶
IsDetached check if is detached.
type LogRange ¶
type LogRange struct {
// contains filtered or unexported fields
}
LogRange git log range.
func NewLogRange ¶
func NewLogRange(t LogRangeType, start, end string) LogRange
NewLogRange LogRange constructor.
type LogRangeType ¶
type LogRangeType string
LogRangeType type of log range.
const ( TagRange LogRangeType = "tag" DateRange LogRangeType = "date" HashRange LogRangeType = "hash" )
constants for log range type.
type MessageProcessor ¶
type MessageProcessor interface { SkipBranch(branch string, detached bool) bool Validate(message string) error ValidateType(ctype string) error ValidateScope(scope string) error ValidateDescription(description string) error Enhance(branch string, message string) (string, error) IssueID(branch string) (string, error) Format(msg CommitMessage) (string, string, string) Parse(subject, body string) (CommitMessage, error) }
MessageProcessor interface.
type MessageProcessorImpl ¶
type MessageProcessorImpl struct {
// contains filtered or unexported fields
}
MessageProcessorImpl process validate message hook.
func NewMessageProcessor ¶
func NewMessageProcessor(mcfg CommitMessageConfig, bcfg BranchesConfig) *MessageProcessorImpl
NewMessageProcessor MessageProcessorImpl constructor.
func (MessageProcessorImpl) Enhance ¶
func (p MessageProcessorImpl) Enhance(branch string, message string) (string, error)
Enhance add metadata on commit message.
func (MessageProcessorImpl) Format ¶
func (p MessageProcessorImpl) Format(msg CommitMessage) (string, string, string)
Format a commit message returning header, body and footer.
func (MessageProcessorImpl) IssueID ¶
func (p MessageProcessorImpl) IssueID(branch string) (string, error)
IssueID try to extract issue id from branch, return empty if not found.
func (MessageProcessorImpl) Parse ¶
func (p MessageProcessorImpl) Parse(subject, body string) (CommitMessage, error)
Parse a commit message.
func (MessageProcessorImpl) SkipBranch ¶
func (p MessageProcessorImpl) SkipBranch(branch string, detached bool) bool
SkipBranch check if branch should be ignored.
func (MessageProcessorImpl) Validate ¶
func (p MessageProcessorImpl) Validate(message string) error
Validate commit message.
func (MessageProcessorImpl) ValidateDescription ¶
func (p MessageProcessorImpl) ValidateDescription(description string) error
ValidateDescription check if commit description is valid.
func (MessageProcessorImpl) ValidateScope ¶
func (p MessageProcessorImpl) ValidateScope(scope string) error
ValidateScope check if commit scope is valid.
func (MessageProcessorImpl) ValidateType ¶
func (p MessageProcessorImpl) ValidateType(ctype string) error
ValidateType check if commit type is valid.
type OutputFormatter ¶
type OutputFormatter interface { FormatReleaseNote(releasenote ReleaseNote) (string, error) FormatChangelog(releasenotes []ReleaseNote) (string, error) }
OutputFormatter output formatter interface.
type OutputFormatterImpl ¶
type OutputFormatterImpl struct {
// contains filtered or unexported fields
}
OutputFormatterImpl formater for release note and changelog.
func NewOutputFormatter ¶
func NewOutputFormatter(templatesFS fs.FS) *OutputFormatterImpl
NewOutputFormatter TemplateProcessor constructor.
func (OutputFormatterImpl) FormatChangelog ¶
func (p OutputFormatterImpl) FormatChangelog(releasenotes []ReleaseNote) (string, error)
FormatChangelog format a changelog.
func (OutputFormatterImpl) FormatReleaseNote ¶
func (p OutputFormatterImpl) FormatReleaseNote(releasenote ReleaseNote) (string, error)
FormatReleaseNote format a release note.
type ReleaseNote ¶
type ReleaseNote struct { Version *semver.Version Tag string Date time.Time Sections []ReleaseNoteSection AuthorsNames map[string]struct{} }
ReleaseNote release note.
type ReleaseNoteBreakingChangeSection ¶ added in v2.7.0
ReleaseNoteBreakingChangeSection breaking change section.
func (ReleaseNoteBreakingChangeSection) SectionName ¶ added in v2.7.0
func (s ReleaseNoteBreakingChangeSection) SectionName() string
SectionName section name.
func (ReleaseNoteBreakingChangeSection) SectionType ¶ added in v2.7.0
func (ReleaseNoteBreakingChangeSection) SectionType() string
SectionType section type.
type ReleaseNoteCommitsSection ¶ added in v2.7.0
type ReleaseNoteCommitsSection struct { Name string Types []string Items []GitCommitLog }
ReleaseNoteCommitsSection release note section.
func (ReleaseNoteCommitsSection) HasMultipleTypes ¶ added in v2.7.0
func (s ReleaseNoteCommitsSection) HasMultipleTypes() bool
HasMultipleTypes return true if has more than one commit type.
func (ReleaseNoteCommitsSection) SectionName ¶ added in v2.7.0
func (s ReleaseNoteCommitsSection) SectionName() string
SectionName section name.
func (ReleaseNoteCommitsSection) SectionType ¶ added in v2.7.0
func (ReleaseNoteCommitsSection) SectionType() string
SectionType section type.
type ReleaseNoteProcessor ¶
type ReleaseNoteProcessor interface {
Create(version *semver.Version, tag string, date time.Time, commits []GitCommitLog) ReleaseNote
}
ReleaseNoteProcessor release note processor interface.
type ReleaseNoteProcessorImpl ¶
type ReleaseNoteProcessorImpl struct {
// contains filtered or unexported fields
}
ReleaseNoteProcessorImpl release note based on commit log.
func NewReleaseNoteProcessor ¶
func NewReleaseNoteProcessor(cfg ReleaseNotesConfig) *ReleaseNoteProcessorImpl
NewReleaseNoteProcessor ReleaseNoteProcessor constructor.
func (ReleaseNoteProcessorImpl) Create ¶
func (p ReleaseNoteProcessorImpl) Create(version *semver.Version, tag string, date time.Time, commits []GitCommitLog) ReleaseNote
Create create a release note based on commits.
type ReleaseNoteSection ¶
ReleaseNoteSection section in release notes.
type ReleaseNotesConfig ¶
type ReleaseNotesConfig struct { Headers map[string]string `yaml:"headers,omitempty"` Sections []ReleaseNotesSectionConfig `yaml:"sections"` }
ReleaseNotesConfig release notes preferences.
type ReleaseNotesSectionConfig ¶ added in v2.7.0
type ReleaseNotesSectionConfig struct { Name string `yaml:"name"` SectionType string `yaml:"section-type"` CommitTypes []string `yaml:"commit-types,flow,omitempty"` }
ReleaseNotesSectionConfig preferences for a single section on release notes.
type SemVerCommitsProcessor ¶
type SemVerCommitsProcessor interface {
NextVersion(version *semver.Version, commits []GitCommitLog) (*semver.Version, bool)
}
SemVerCommitsProcessor interface.
type SemVerCommitsProcessorImpl ¶
type SemVerCommitsProcessorImpl struct { MajorVersionTypes map[string]struct{} MinorVersionTypes map[string]struct{} PatchVersionTypes map[string]struct{} KnownTypes []string IncludeUnknownTypeAsPatch bool }
SemVerCommitsProcessorImpl process versions using commit log.
func NewSemVerCommitsProcessor ¶
func NewSemVerCommitsProcessor(vcfg VersioningConfig, mcfg CommitMessageConfig) *SemVerCommitsProcessorImpl
NewSemVerCommitsProcessor SemanticVersionCommitsProcessorImpl constructor.
func (SemVerCommitsProcessorImpl) NextVersion ¶
func (p SemVerCommitsProcessorImpl) NextVersion(version *semver.Version, commits []GitCommitLog) (*semver.Version, bool)
NextVersion calculates next version based on commit log.