refactor: move commit analyzing out of forge

This commit is contained in:
Julian Tölle 2024-08-17 16:26:40 +02:00
parent f2a982d7a0
commit 5882a6bf2c
11 changed files with 152 additions and 188 deletions

View file

@ -7,6 +7,19 @@ import (
"github.com/leodido/go-conventionalcommits/parser"
)
type Commit struct {
Hash string
Message string
PullRequest *PullRequest
}
type PullRequest struct {
ID int
Title string
Description string
}
type AnalyzedCommit struct {
Commit
Type string
@ -34,7 +47,7 @@ func NewConventionalCommitsParser() *ConventionalCommitsParser {
}
}
func (c *ConventionalCommitsParser) AnalyzeCommits(commits []Commit) ([]AnalyzedCommit, error) {
func (c *ConventionalCommitsParser) Analyze(commits []Commit) ([]AnalyzedCommit, error) {
analyzedCommits := make([]AnalyzedCommit, 0, len(commits))
for _, commit := range commits {