Skip to content

Commit 417d823

Browse files
committed
fix: barry quick fix, 2025-09-07 18:29:51
1 parent 1e7ac42 commit 417d823

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.version

Whitespace-only changes.

utils/util.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,29 @@ import (
1818
"github.com/samber/lo"
1919
)
2020

21+
func GetAllRemoteTags() []*semver.Version {
22+
log.Info().Msg("get all remote tags")
23+
output := assert.Exit1(RunOutput("git", "ls-remote", "--tags", "origin"))
24+
return lo.Map(strings.Split(output, "\n"), func(item string, index int) *semver.Version {
25+
item = strings.TrimSpace(item)
26+
if !strings.HasPrefix(item, "refs/tags/") {
27+
return nil
28+
}
29+
30+
item = strings.TrimPrefix(item, "refs/tags/")
31+
if !strings.HasPrefix(item, "v") {
32+
return nil
33+
}
34+
35+
vv, err := semver.NewSemver(item)
36+
if err != nil {
37+
log.Err(err).Str("tag", item).Msg("failed to parse git tag")
38+
assert.Must(err)
39+
}
40+
return vv
41+
})
42+
}
43+
2144
func GetAllGitTags() []*semver.Version {
2245
log.Info().Msg("get all tags")
2346
var tagText = strings.TrimSpace(assert.Must1(RunOutput("git", "tag")))

0 commit comments

Comments
 (0)