refactor: Various cleanup (#11)

* refactor: interface for commit message analyzer

* refactor: interface for versioning strategy

* refactor(releasepr): rebuild pr description

Build PR description from scratch and parsed values instead of copying some of the AST to next description.
This commit is contained in:
Julian Tölle 2024-08-08 19:01:44 +02:00 committed by GitHub
parent 8f106e4028
commit d8daad7623
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 197 additions and 268 deletions

View file

@ -13,7 +13,11 @@ type Releases struct {
Stable *Tag
}
func (r Releases) NextVersion(versionBump conventionalcommits.VersionBump, nextVersionType NextVersionType) (string, error) {
type VersioningStrategy = func(Releases, conventionalcommits.VersionBump, NextVersionType) (string, error)
var _ VersioningStrategy = SemVerNextVersion
func SemVerNextVersion(r Releases, versionBump conventionalcommits.VersionBump, nextVersionType NextVersionType) (string, error) {
latest, err := parseSemverWithDefault(r.Latest)
if err != nil {
return "", fmt.Errorf("failed to parse latest version: %w", err)