MCPcopy Create free account
hub / github.com/spicetify/cli / FetchLatestTag

Function FetchLatestTag

src/utils/vcs.go:15–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13}
14
15func FetchLatestTag() (string, error) {
16 res, err := http.Get("https://api.github.com/repos/spicetify/cli/releases/latest")
17 if err != nil {
18 return "", err
19 }
20
21 body, err := io.ReadAll(res.Body)
22 if err != nil {
23 return "", err
24 }
25
26 var release GithubRelease
27 if err = json.Unmarshal(body, &release); err != nil {
28 return "", err
29 }
30
31 if release.TagName == "" {
32 return "", errors.New("GitHub response: " + release.Message)
33 }
34
35 return release.TagName[1:], nil
36}

Callers 3

CheckUpdateFunction · 0.92
UpdateFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected