MCPcopy Create free account
hub / github.com/dnote/dnote / fetchLatestStableTag

Function fetchLatestStableTag

pkg/cli/upgrade/upgrade.go:62–85  ·  view source on GitHub ↗
(gh *github.Client, page int)

Source from the content-addressed store, hash-verified

60}
61
62func fetchLatestStableTag(gh *github.Client, page int) (string, error) {
63 params := github.ListOptions{
64 Page: page,
65 }
66 releases, resp, err := gh.Repositories.ListReleases(stdCtx.Background(), "dnote", "dnote", &params)
67 if err != nil {
68 return "", errors.Wrapf(err, "fetching releases page %d", page)
69 }
70
71 for _, release := range releases {
72 tag := release.GetTagName()
73 isStable := !release.GetPrerelease()
74
75 if strings.HasPrefix(tag, "cli-") && isStable {
76 return tag, nil
77 }
78 }
79
80 if page == resp.LastPage {
81 return "", errors.New("No CLI release was found")
82 }
83
84 return fetchLatestStableTag(gh, page+1)
85}
86
87func checkVersion(ctx context.DnoteCtx) error {
88 log.Infof("current version is %s\n", ctx.Version)

Callers 3

TestFetchLatestStableTagFunction · 0.85
checkVersionFunction · 0.85

Calls 1

NewMethod · 0.80

Tested by 2

TestFetchLatestStableTagFunction · 0.68