refactor: move git to package

This commit is contained in:
Julian Tölle 2024-08-30 22:47:50 +02:00
parent 44184a77f9
commit 5765b48703
10 changed files with 114 additions and 102 deletions

View file

@ -4,6 +4,8 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/apricote/releaser-pleaser/internal/git"
)
func ptr[T any](input T) *T {
@ -39,7 +41,7 @@ func Test_NewChangelogEntry(t *testing.T) {
args: args{
analyzedCommits: []AnalyzedCommit{
{
Commit: Commit{},
Commit: git.Commit{},
Type: "feat",
Description: "Foobar!",
},
@ -55,7 +57,7 @@ func Test_NewChangelogEntry(t *testing.T) {
args: args{
analyzedCommits: []AnalyzedCommit{
{
Commit: Commit{},
Commit: git.Commit{},
Type: "fix",
Description: "Foobar!",
},
@ -71,23 +73,23 @@ func Test_NewChangelogEntry(t *testing.T) {
args: args{
analyzedCommits: []AnalyzedCommit{
{
Commit: Commit{},
Commit: git.Commit{},
Type: "feat",
Description: "Blabla!",
},
{
Commit: Commit{},
Commit: git.Commit{},
Type: "feat",
Description: "So awesome!",
Scope: ptr("awesome"),
},
{
Commit: Commit{},
Commit: git.Commit{},
Type: "fix",
Description: "Foobar!",
},
{
Commit: Commit{},
Commit: git.Commit{},
Type: "fix",
Description: "So sad!",
Scope: ptr("sad"),
@ -114,7 +116,7 @@ func Test_NewChangelogEntry(t *testing.T) {
args: args{
analyzedCommits: []AnalyzedCommit{
{
Commit: Commit{},
Commit: git.Commit{},
Type: "fix",
Description: "Foobar!",
},
@ -137,7 +139,7 @@ func Test_NewChangelogEntry(t *testing.T) {
args: args{
analyzedCommits: []AnalyzedCommit{
{
Commit: Commit{},
Commit: git.Commit{},
Type: "fix",
Description: "Foobar!",
},

View file

@ -5,23 +5,12 @@ import (
"github.com/leodido/go-conventionalcommits"
"github.com/leodido/go-conventionalcommits/parser"
"github.com/apricote/releaser-pleaser/internal/git"
)
type Commit struct {
Hash string
Message string
PullRequest *PullRequest
}
type PullRequest struct {
ID int
Title string
Description string
}
type AnalyzedCommit struct {
Commit
git.Commit
Type string
Description string
Scope *string
@ -29,7 +18,7 @@ type AnalyzedCommit struct {
}
type CommitParser interface {
Analyze(commits []Commit) ([]AnalyzedCommit, error)
Analyze(commits []git.Commit) ([]AnalyzedCommit, error)
}
type ConventionalCommitsParser struct {
@ -47,7 +36,7 @@ func NewConventionalCommitsParser() *ConventionalCommitsParser {
}
}
func (c *ConventionalCommitsParser) Analyze(commits []Commit) ([]AnalyzedCommit, error) {
func (c *ConventionalCommitsParser) Analyze(commits []git.Commit) ([]AnalyzedCommit, error) {
analyzedCommits := make([]AnalyzedCommit, 0, len(commits))
for _, commit := range commits {

View file

@ -4,24 +4,26 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/apricote/releaser-pleaser/internal/git"
)
func TestAnalyzeCommits(t *testing.T) {
tests := []struct {
name string
commits []Commit
commits []git.Commit
expectedCommits []AnalyzedCommit
wantErr assert.ErrorAssertionFunc
}{
{
name: "empty commits",
commits: []Commit{},
commits: []git.Commit{},
expectedCommits: []AnalyzedCommit{},
wantErr: assert.NoError,
},
{
name: "malformed commit message",
commits: []Commit{
commits: []git.Commit{
{
Message: "aksdjaklsdjka",
},
@ -31,7 +33,7 @@ func TestAnalyzeCommits(t *testing.T) {
},
{
name: "drops unreleasable",
commits: []Commit{
commits: []git.Commit{
{
Message: "chore: foobar",
},
@ -41,7 +43,7 @@ func TestAnalyzeCommits(t *testing.T) {
},
{
name: "highest bump (patch)",
commits: []Commit{
commits: []git.Commit{
{
Message: "chore: foobar",
},
@ -51,7 +53,7 @@ func TestAnalyzeCommits(t *testing.T) {
},
expectedCommits: []AnalyzedCommit{
{
Commit: Commit{Message: "fix: blabla"},
Commit: git.Commit{Message: "fix: blabla"},
Type: "fix",
Description: "blabla",
},
@ -60,7 +62,7 @@ func TestAnalyzeCommits(t *testing.T) {
},
{
name: "highest bump (minor)",
commits: []Commit{
commits: []git.Commit{
{
Message: "fix: blabla",
},
@ -70,12 +72,12 @@ func TestAnalyzeCommits(t *testing.T) {
},
expectedCommits: []AnalyzedCommit{
{
Commit: Commit{Message: "fix: blabla"},
Commit: git.Commit{Message: "fix: blabla"},
Type: "fix",
Description: "blabla",
},
{
Commit: Commit{Message: "feat: foobar"},
Commit: git.Commit{Message: "feat: foobar"},
Type: "feat",
Description: "foobar",
},
@ -85,7 +87,7 @@ func TestAnalyzeCommits(t *testing.T) {
{
name: "highest bump (major)",
commits: []Commit{
commits: []git.Commit{
{
Message: "fix: blabla",
},
@ -95,12 +97,12 @@ func TestAnalyzeCommits(t *testing.T) {
},
expectedCommits: []AnalyzedCommit{
{
Commit: Commit{Message: "fix: blabla"},
Commit: git.Commit{Message: "fix: blabla"},
Type: "fix",
Description: "blabla",
},
{
Commit: Commit{Message: "feat!: foobar"},
Commit: git.Commit{Message: "feat!: foobar"},
Type: "feat",
Description: "foobar",
BreakingChange: true,

View file

@ -13,6 +13,8 @@ import (
"github.com/go-git/go-git/v5/plumbing/transport"
"github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/google/go-github/v63/github"
"github.com/apricote/releaser-pleaser/internal/git"
)
const (
@ -38,7 +40,7 @@ type Forge interface {
// CommitsSince returns all commits to main branch after the Tag. The tag can be `nil`, in which case this
// function should return all commits.
CommitsSince(context.Context, *Tag) ([]Commit, error)
CommitsSince(context.Context, *git.Tag) ([]git.Commit, error)
// EnsureLabelsExist verifies that all desired labels are available on the repository. If labels are missing, they
// are created them.
@ -68,7 +70,7 @@ type Forge interface {
PendingReleases(context.Context, Label) ([]*ReleasePullRequest, error)
// CreateRelease creates a release on the Forge, pointing at the commit with the passed in details.
CreateRelease(ctx context.Context, commit Commit, title, changelog string, prerelease, latest bool) error
CreateRelease(ctx context.Context, commit git.Commit, title, changelog string, prerelease, latest bool) error
}
type ForgeOptions struct {
@ -123,7 +125,7 @@ func (g *GitHub) LatestTags(ctx context.Context) (Releases, error) {
}
for _, ghTag := range tags {
tag := &Tag{
tag := &git.Tag{
Hash: ghTag.GetCommit().GetSHA(),
Name: ghTag.GetName(),
}
@ -160,7 +162,7 @@ func (g *GitHub) LatestTags(ctx context.Context) (Releases, error) {
return releases, nil
}
func (g *GitHub) CommitsSince(ctx context.Context, tag *Tag) ([]Commit, error) {
func (g *GitHub) CommitsSince(ctx context.Context, tag *git.Tag) ([]git.Commit, error) {
var repositoryCommits []*github.RepositoryCommit
var err error
if tag != nil {
@ -173,9 +175,9 @@ func (g *GitHub) CommitsSince(ctx context.Context, tag *Tag) ([]Commit, error) {
return nil, err
}
var commits = make([]Commit, 0, len(repositoryCommits))
var commits = make([]git.Commit, 0, len(repositoryCommits))
for _, ghCommit := range repositoryCommits {
commit := Commit{
commit := git.Commit{
Hash: ghCommit.GetSHA(),
Message: ghCommit.GetCommit().GetMessage(),
}
@ -190,7 +192,7 @@ func (g *GitHub) CommitsSince(ctx context.Context, tag *Tag) ([]Commit, error) {
return commits, nil
}
func (g *GitHub) commitsSinceTag(ctx context.Context, tag *Tag) ([]*github.RepositoryCommit, error) {
func (g *GitHub) commitsSinceTag(ctx context.Context, tag *git.Tag) ([]*github.RepositoryCommit, error) {
head := g.options.BaseBranch
log := g.log.With("base", tag.Hash, "head", head)
log.Debug("comparing commits", "base", tag.Hash, "head", head)
@ -269,7 +271,7 @@ func (g *GitHub) commitsSinceInit(ctx context.Context) ([]*github.RepositoryComm
return repositoryCommits, nil
}
func (g *GitHub) prForCommit(ctx context.Context, commit Commit) (*PullRequest, error) {
func (g *GitHub) prForCommit(ctx context.Context, commit git.Commit) (*git.PullRequest, error) {
// We naively look up the associated PR for each commit through the "List pull requests associated with a commit"
// endpoint. This requires len(commits) requests.
// Using the "List pull requests" endpoint might be faster, as it allows us to fetch 100 arbitrary PRs per request,
@ -526,7 +528,7 @@ func (g *GitHub) PendingReleases(ctx context.Context, pendingLabel Label) ([]*Re
return prs, nil
}
func (g *GitHub) CreateRelease(ctx context.Context, commit Commit, title, changelog string, preRelease, latest bool) error {
func (g *GitHub) CreateRelease(ctx context.Context, commit git.Commit, title, changelog string, preRelease, latest bool) error {
makeLatest := ""
if latest {
makeLatest = "true"
@ -551,8 +553,8 @@ func (g *GitHub) CreateRelease(ctx context.Context, commit Commit, title, change
return nil
}
func gitHubPRToPullRequest(pr *github.PullRequest) *PullRequest {
return &PullRequest{
func gitHubPRToPullRequest(pr *github.PullRequest) *git.PullRequest {
return &git.PullRequest{
ID: pr.GetNumber(),
Title: pr.GetTitle(),
Description: pr.GetBody(),
@ -568,9 +570,9 @@ func gitHubPRToReleasePullRequest(pr *github.PullRequest) *ReleasePullRequest {
}
}
var releaseCommit *Commit
var releaseCommit *git.Commit
if pr.MergeCommitSHA != nil {
releaseCommit = &Commit{Hash: pr.GetMergeCommitSHA()}
releaseCommit = &git.Commit{Hash: pr.GetMergeCommitSHA()}
}
return &ReleasePullRequest{

View file

@ -1 +0,0 @@
package rp

View file

@ -1,4 +1,4 @@
package rp
package git
import (
"context"
@ -13,9 +13,22 @@ import (
)
const (
GitRemoteName = "origin"
RemoteName = "origin"
)
type Commit struct {
Hash string
Message string
PullRequest *PullRequest
}
type PullRequest struct {
ID int
Title string
Description string
}
type Tag struct {
Hash string
Name string
@ -27,11 +40,9 @@ func CloneRepo(ctx context.Context, cloneURL, branch string, auth transport.Auth
return nil, fmt.Errorf("failed to create temporary directory for repo clone: %w", err)
}
// TODO: Log tmpdir
fmt.Printf("Clone tmpdir: %s\n", dir)
repo, err := git.PlainCloneContext(ctx, dir, false, &git.CloneOptions{
URL: cloneURL,
RemoteName: GitRemoteName,
RemoteName: RemoteName,
ReferenceName: plumbing.NewBranchReferenceName(branch),
SingleBranch: false,
Auth: auth,
@ -43,7 +54,7 @@ func CloneRepo(ctx context.Context, cloneURL, branch string, auth transport.Auth
return repo, nil
}
func GitSignature() *object.Signature {
func Signature() *object.Signature {
return &object.Signature{
Name: "releaser-pleaser",
Email: "",

View file

@ -12,6 +12,7 @@ import (
"github.com/yuin/goldmark/ast"
"github.com/yuin/goldmark/text"
"github.com/apricote/releaser-pleaser/internal/git"
"github.com/apricote/releaser-pleaser/internal/markdown"
east "github.com/apricote/releaser-pleaser/internal/markdown/extensions/ast"
)
@ -41,7 +42,7 @@ type ReleasePullRequest struct {
Labels []Label
Head string
ReleaseCommit *Commit
ReleaseCommit *git.Commit
}
func NewReleasePullRequest(head, branch, version, changelogEntry string) (*ReleasePullRequest, error) {

View file

@ -10,6 +10,8 @@ import (
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
git2 "github.com/apricote/releaser-pleaser/internal/git"
)
const (
@ -224,7 +226,7 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
logger.InfoContext(ctx, "next version", "version", nextVersion)
logger.DebugContext(ctx, "cloning repository", "clone.url", rp.forge.CloneURL())
repo, err := CloneRepo(ctx, rp.forge.CloneURL(), rp.targetBranch, rp.forge.GitAuth())
repo, err := git2.CloneRepo(ctx, rp.forge.CloneURL(), rp.targetBranch, rp.forge.GitAuth())
if err != nil {
return fmt.Errorf("failed to clone repository: %w", err)
}
@ -317,8 +319,8 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
releaseCommitMessage := fmt.Sprintf("chore(%s): release %s", rp.targetBranch, nextVersion)
releaseCommitHash, err := worktree.Commit(releaseCommitMessage, &git.CommitOptions{
Author: GitSignature(),
Committer: GitSignature(),
Author: git2.Signature(),
Committer: git2.Signature(),
})
if err != nil {
return fmt.Errorf("failed to commit changes: %w", err)
@ -329,7 +331,7 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
newReleasePRChanges := true
// Check if anything changed in comparison to the remote branch (if exists)
if remoteRef, err := repo.Reference(plumbing.NewRemoteReferenceName(GitRemoteName, rpBranch), false); err != nil {
if remoteRef, err := repo.Reference(plumbing.NewRemoteReferenceName(git2.RemoteName, rpBranch), false); err != nil {
if err.Error() != "reference not found" {
// "reference not found" is expected and we should always push
return err
@ -363,7 +365,7 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
))
logger.DebugContext(ctx, "pushing branch", "commit.hash", releaseCommitHash.String(), "branch.name", rpBranch, "refspec", pushRefSpec.String())
if err = repo.PushContext(ctx, &git.PushOptions{
RemoteName: GitRemoteName,
RemoteName: git2.RemoteName,
RefSpecs: []config.RefSpec{pushRefSpec},
Force: true,
Auth: rp.forge.GitAuth(),

View file

@ -6,11 +6,13 @@ import (
"github.com/blang/semver/v4"
"github.com/leodido/go-conventionalcommits"
"github.com/apricote/releaser-pleaser/internal/git"
)
type Releases struct {
Latest *Tag
Stable *Tag
Latest *git.Tag
Stable *git.Tag
}
type VersioningStrategy = func(Releases, conventionalcommits.VersionBump, NextVersionType) (string, error)
@ -97,7 +99,7 @@ func setPRVersion(version *semver.Version, prType string, count uint64) {
}
}
func parseSemverWithDefault(tag *Tag) (semver.Version, error) {
func parseSemverWithDefault(tag *git.Tag) (semver.Version, error) {
version := "v0.0.0"
if tag != nil {
version = tag.Name

View file

@ -6,6 +6,8 @@ import (
"github.com/leodido/go-conventionalcommits"
"github.com/stretchr/testify/assert"
"github.com/apricote/releaser-pleaser/internal/git"
)
func TestReleases_NextVersion(t *testing.T) {
@ -24,8 +26,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "simple bump (major)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.1"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.MajorVersion,
nextVersionType: NextVersionTypeUndefined,
@ -37,8 +39,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "simple bump (minor)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.1"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.MinorVersion,
nextVersionType: NextVersionTypeUndefined,
@ -50,8 +52,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "simple bump (patch)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.1"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.PatchVersion,
nextVersionType: NextVersionTypeUndefined,
@ -63,8 +65,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "normal to prerelease (major)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.1"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.MajorVersion,
nextVersionType: NextVersionTypeRC,
@ -76,8 +78,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "normal to prerelease (minor)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.1"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.MinorVersion,
nextVersionType: NextVersionTypeRC,
@ -89,8 +91,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "normal to prerelease (patch)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.1"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.PatchVersion,
nextVersionType: NextVersionTypeRC,
@ -102,8 +104,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "prerelease bump (major)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v2.0.0-rc.0"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v2.0.0-rc.0"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.MajorVersion,
nextVersionType: NextVersionTypeRC,
@ -115,8 +117,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "prerelease bump (minor)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.2.0-rc.0"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.2.0-rc.0"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.MinorVersion,
nextVersionType: NextVersionTypeRC,
@ -128,8 +130,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "prerelease bump (patch)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.2-rc.0"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.2-rc.0"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.PatchVersion,
nextVersionType: NextVersionTypeRC,
@ -141,8 +143,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "prerelease different bump (major)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.2.0-rc.0"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.2.0-rc.0"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.MajorVersion,
nextVersionType: NextVersionTypeRC,
@ -154,8 +156,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "prerelease different bump (minor)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.2-rc.0"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.2-rc.0"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.MinorVersion,
nextVersionType: NextVersionTypeRC,
@ -167,8 +169,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "prerelease to prerelease",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1-alpha.2"},
Stable: &Tag{Name: "v1.1.0"},
Latest: &git.Tag{Name: "v1.1.1-alpha.2"},
Stable: &git.Tag{Name: "v1.1.0"},
},
versionBump: conventionalcommits.PatchVersion,
nextVersionType: NextVersionTypeRC,
@ -180,8 +182,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "prerelease to normal (explicit)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1-alpha.2"},
Stable: &Tag{Name: "v1.1.0"},
Latest: &git.Tag{Name: "v1.1.1-alpha.2"},
Stable: &git.Tag{Name: "v1.1.0"},
},
versionBump: conventionalcommits.PatchVersion,
nextVersionType: NextVersionTypeNormal,
@ -193,8 +195,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "prerelease to normal (implicit)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1-alpha.2"},
Stable: &Tag{Name: "v1.1.0"},
Latest: &git.Tag{Name: "v1.1.1-alpha.2"},
Stable: &git.Tag{Name: "v1.1.0"},
},
versionBump: conventionalcommits.PatchVersion,
nextVersionType: NextVersionTypeUndefined,
@ -245,7 +247,7 @@ func TestReleases_NextVersion(t *testing.T) {
name: "nil stable release (major)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1-rc.0"},
Latest: &git.Tag{Name: "v1.1.1-rc.0"},
Stable: nil,
},
versionBump: conventionalcommits.MajorVersion,
@ -258,7 +260,7 @@ func TestReleases_NextVersion(t *testing.T) {
name: "nil stable release (minor)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1-rc.0"},
Latest: &git.Tag{Name: "v1.1.1-rc.0"},
Stable: nil,
},
versionBump: conventionalcommits.MinorVersion,
@ -271,7 +273,7 @@ func TestReleases_NextVersion(t *testing.T) {
name: "nil stable release (patch)",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1-rc.0"},
Latest: &git.Tag{Name: "v1.1.1-rc.0"},
Stable: nil,
},
versionBump: conventionalcommits.PatchVersion,
@ -285,8 +287,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "error on invalid tag semver",
args: args{
releases: Releases{
Latest: &Tag{Name: "foodazzle"},
Stable: &Tag{Name: "foodazzle"},
Latest: &git.Tag{Name: "foodazzle"},
Stable: &git.Tag{Name: "foodazzle"},
},
versionBump: conventionalcommits.PatchVersion,
nextVersionType: NextVersionTypeRC,
@ -298,8 +300,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "error on invalid tag prerelease",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1-rc.foo"},
Stable: &Tag{Name: "v1.1.1-rc.foo"},
Latest: &git.Tag{Name: "v1.1.1-rc.foo"},
Stable: &git.Tag{Name: "v1.1.1-rc.foo"},
},
versionBump: conventionalcommits.PatchVersion,
nextVersionType: NextVersionTypeRC,
@ -311,8 +313,8 @@ func TestReleases_NextVersion(t *testing.T) {
name: "error on invalid bump",
args: args{
releases: Releases{
Latest: &Tag{Name: "v1.1.1"},
Stable: &Tag{Name: "v1.1.1"},
Latest: &git.Tag{Name: "v1.1.1"},
Stable: &git.Tag{Name: "v1.1.1"},
},
versionBump: conventionalcommits.UnknownVersion,