Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryEscape markdown badge values for badge creation #5

Merged
merged 1 commit into from
Oct 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pkg/output/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package output

import (
"fmt"
"net/url"
"os"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -32,11 +33,11 @@ func Markdown(log *logrus.Logger, changeLogFilePath string, releases []*helm.Rel

for _, release := range releases {

if release.Chart.Deprecated {
f.WriteString(fmt.Sprintf("## %s (DEPRECATED)\n\n", release.Chart.Version))
} else {
f.WriteString(fmt.Sprintf("## %s\n\n", release.Chart.Version))
}
if release.Chart.Deprecated {
f.WriteString(fmt.Sprintf("## %s (DEPRECATED)\n\n", release.Chart.Version))
} else {
f.WriteString(fmt.Sprintf("## %s\n\n", release.Chart.Version))
}

if release.ReleaseDate != nil {
f.WriteString(fmt.Sprintf("**Release date:** %s\n\n", release.ReleaseDate.Format("2006-01-02")))
Expand Down Expand Up @@ -88,5 +89,5 @@ func Markdown(log *logrus.Logger, changeLogFilePath string, releases []*helm.Rel
}

func badge(key, value, icon, style string) string {
return fmt.Sprintf("![%s: %s](https://img.shields.io/static/v1?label=%s&message=%s&color=%s&logo=%s)\n", key, value, key, value, style, icon)
return fmt.Sprintf("![%s: %s](https://img.shields.io/static/v1?label=%s&message=%s&color=%s&logo=%s)\n", key, value, key, url.QueryEscape(value), style, icon)
}