mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 21:21:03 +00:00
fix(parser): continue on unparsable commit message (#48)
We should not fail the whole process if a single commit message is unparsable. Instead we now log the issue and ignore the commit.
This commit is contained in:
parent
2010ac1143
commit
5ea41654a7
3 changed files with 13 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package conventionalcommits
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
|
@ -23,14 +24,14 @@ func TestAnalyzeCommits(t *testing.T) {
|
|||
wantErr: assert.NoError,
|
||||
},
|
||||
{
|
||||
name: "malformed commit message",
|
||||
name: "skips malformed commit message",
|
||||
commits: []git.Commit{
|
||||
{
|
||||
Message: "aksdjaklsdjka",
|
||||
},
|
||||
},
|
||||
expectedCommits: nil,
|
||||
wantErr: assert.Error,
|
||||
expectedCommits: []commitparser.AnalyzedCommit{},
|
||||
wantErr: assert.NoError,
|
||||
},
|
||||
{
|
||||
name: "drops unreleasable",
|
||||
|
|
@ -114,7 +115,7 @@ func TestAnalyzeCommits(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
analyzedCommits, err := NewParser().Analyze(tt.commits)
|
||||
analyzedCommits, err := NewParser(slog.Default()).Analyze(tt.commits)
|
||||
if !tt.wantErr(t, err) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue