mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-02-07 10:17:02 +00:00
refactor: move commit analyzing out of forge
This commit is contained in:
parent
f2a982d7a0
commit
5882a6bf2c
11 changed files with 152 additions and 188 deletions
|
|
@ -69,24 +69,22 @@ func SemVerNextVersion(r Releases, versionBump conventionalcommits.VersionBump,
|
|||
return "v" + next.String(), nil
|
||||
}
|
||||
|
||||
func VersionBumpFromChangesets(changesets []Changeset) conventionalcommits.VersionBump {
|
||||
func VersionBumpFromCommits(commits []AnalyzedCommit) conventionalcommits.VersionBump {
|
||||
bump := conventionalcommits.UnknownVersion
|
||||
|
||||
for _, changeset := range changesets {
|
||||
for _, entry := range changeset.ChangelogEntries {
|
||||
entryBump := conventionalcommits.UnknownVersion
|
||||
switch {
|
||||
case entry.BreakingChange:
|
||||
entryBump = conventionalcommits.MajorVersion
|
||||
case entry.Type == "feat":
|
||||
entryBump = conventionalcommits.MinorVersion
|
||||
case entry.Type == "fix":
|
||||
entryBump = conventionalcommits.PatchVersion
|
||||
}
|
||||
for _, commit := range commits {
|
||||
entryBump := conventionalcommits.UnknownVersion
|
||||
switch {
|
||||
case commit.BreakingChange:
|
||||
entryBump = conventionalcommits.MajorVersion
|
||||
case commit.Type == "feat":
|
||||
entryBump = conventionalcommits.MinorVersion
|
||||
case commit.Type == "fix":
|
||||
entryBump = conventionalcommits.PatchVersion
|
||||
}
|
||||
|
||||
if entryBump > bump {
|
||||
bump = entryBump
|
||||
}
|
||||
if entryBump > bump {
|
||||
bump = entryBump
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue