MCPcopy Create free account
hub / github.com/wailsapp/wails / GetReleaseNotes

Function GetReleaseNotes

v2/internal/github/github.go:17–57  ·  view source on GitHub ↗
(tagVersion string, noColour bool)

Source from the content-addressed store, hash-verified

15)
16
17func GetReleaseNotes(tagVersion string, noColour bool) string {
18 resp, err := http.Get("https://api.github.com/repos/wailsapp/wails/releases/tags/" + url.PathEscape(tagVersion))
19 if err != nil {
20 return "Unable to retrieve release notes. Please check your network connection"
21 }
22 body, err := io.ReadAll(resp.Body)
23 if err != nil {
24 return "Unable to retrieve release notes. Please check your network connection"
25 }
26
27 data := map[string]interface{}{}
28 err = json.Unmarshal(body, &data)
29 if err != nil {
30 return "Unable to retrieve release notes. Please check your network connection"
31 }
32
33 if data["body"] == nil {
34 return "No release notes found"
35 }
36
37 result := "# Release Notes for " + tagVersion + "\n" + data["body"].(string)
38 var renderer *glamour.TermRenderer
39
40 var termRendererOpts []glamour.TermRendererOption
41
42 if runtime.GOOS == "windows" || noColour {
43 termRendererOpts = append(termRendererOpts, glamour.WithStyles(styles.NoTTYStyleConfig))
44 } else {
45 termRendererOpts = append(termRendererOpts, glamour.WithAutoStyle())
46 }
47
48 renderer, err = glamour.NewTermRenderer(termRendererOpts...)
49 if err != nil {
50 return result
51 }
52 result, err = renderer.Render(result)
53 if err != nil {
54 return err.Error()
55 }
56 return result
57}
58
59// GetVersionTags gets the list of tags on the Wails repo
60// It returns a list of sorted tags in descending order

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.65
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…