Load potential additional release notes from within the repo
(newVer string)
| 60 | |
| 61 | // Load potential additional release notes from within the repo |
| 62 | func additionalNotes(newVer string) ([]string, error) { |
| 63 | data := map[string]string{ |
| 64 | "version": strings.TrimLeft(newVer, "v"), |
| 65 | } |
| 66 | |
| 67 | var notes []string |
| 68 | ver, _, _ := strings.Cut(newVer, "-") |
| 69 | for { |
| 70 | file := fmt.Sprintf("relnotes/%s.md", ver) |
| 71 | if bs, err := os.ReadFile(file); err == nil { |
| 72 | tpl, err := template.New("notes").Parse(string(bs)) |
| 73 | if err != nil { |
| 74 | return nil, err |
| 75 | } |
| 76 | buf := new(bytes.Buffer) |
| 77 | if err := tpl.Execute(buf, data); err != nil { |
| 78 | return nil, err |
| 79 | } |
| 80 | notes = append(notes, strings.TrimSpace(buf.String())) |
| 81 | } else if !os.IsNotExist(err) { |
| 82 | return nil, err |
| 83 | } |
| 84 | |
| 85 | if idx := strings.LastIndex(ver, "."); idx > 0 { |
| 86 | ver = ver[:idx] |
| 87 | } else { |
| 88 | break |
| 89 | } |
| 90 | } |
| 91 | return notes, nil |
| 92 | } |
| 93 | |
| 94 | // Load generated release notes (list of pull requests and contributors) |
| 95 | // from GitHub. |