Skip to content

Commit

Permalink
final bugfix i hope (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
walteh authored Nov 18, 2023
2 parents 065ce8d + 04c787e commit 922333d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/simver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
{
name: install simver,
run: "go install github.com/walteh/simver/cmd/simver_github_actions@v0.5.0",
run: "go install github.com/walteh/simver/cmd/simver_github_actions@v0.7.0-pr5+1",
},
{
name: run simver,
Expand Down
14 changes: 7 additions & 7 deletions calculate.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ func (me *Calculation) CalculateNewTagsRaw(ctx context.Context) *CalculationOutp
nvt = BumpPatch(mmrt)
}

if me.MyMostRecentBuild == 0 {
validMmrt = false

// force patch is ignored if this is a merge
} else if me.ForcePatch && !me.IsMerge {
nvt = BumpPatch(mmrt)
validMmrt = false
if !me.IsMerge {
if me.MyMostRecentBuild == 0 {
validMmrt = false
} else if me.ForcePatch {
nvt = BumpPatch(mmrt)
validMmrt = false
}
}

// if mmrt is invalid, then we need to reserve a new mmrt (which is the same as nvt)
Expand Down
19 changes: 19 additions & 0 deletions calculate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,25 @@ func TestNewCalculationAndCalculateNewTags(t *testing.T) {
MergeTags: []string{},
},
},
{
name: "if is merge, build is 0, skip is false - tag mmrt",
calculation: &simver.Calculation{
ForcePatch: false,
IsMerge: true,
MostRecentLiveTag: "v0.18.0",
MyMostRecentBuild: 0.000000,
MyMostRecentTag: "v0.18.1",
NextValidTag: "v0.19.0",
PR: 14.000000,
Skip: false,
},
output: &simver.CalculationOutput{
BaseTags: []string{},
HeadTags: []string{},
RootTags: []string{},
MergeTags: []string{"v0.18.1"},
},
},
}

ctx := context.Background()
Expand Down

0 comments on commit 922333d

Please sign in to comment.