INNER CODE UNIT · Go
createChangelogTemplate
projectcontour/contour · hack/actions/bump-envoy-version/main.go:154
func createChangelogTemplate(version string) string {
u, err := user.Current()
if err != nil {
log.WithError(err).Fatal("Failed to get current user")
}
file := fmt.Sprintf("changelogs/unreleased/dddd-%s-small.md", u.Username)
majorMinor := version[:strings.LastIndex(version, ".")]
url := fmt.Sprintf("https://www.envoyproxy.io/docs/envoy/%s/version_history/%s/%s", version, majorMinor, version)
content := fmt.Sprintf("Updates Envoy to %s. See the [Envoy release notes](%s) for more information about the content of the release.\n", version, url)
if err := os.WriteFile(file, []byte(content), 0o600); err != nil {
log.WithError(err).Fatal("Failed to write changelog")
}
log.Infof("Created changelog template: %s", file)
return file
}