Skip to content

Commit

Permalink
Add name slugs that are URL safe
Browse files Browse the repository at this point in the history
Signed-off-by: Matias Pan <[email protected]>
  • Loading branch information
matipan committed Mar 7, 2024
1 parent 13202f1 commit c4b5eb2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ func generatorHandler(l zerolog.Logger) http.HandlerFunc {
}

type Release struct {
Name string `json:"name"`
Commit Commit `json:"commit"`
NodeID string `json:"node_id"`
Name string `json:"name"`
NameSlug string `json:"name_slug"`
Commit Commit `json:"commit"`
NodeID string `json:"node_id"`
}

type Commit struct {
Expand All @@ -139,6 +140,7 @@ func getFilteredReleases(releases []Release, minRelease string) []Release {
var filteredReleases []Release
for _, r := range releases {
if semver.Compare(r.Name, minRelease) > 0 {
r.NameSlug = strings.ReplaceAll(r.Name, ".", "-")
filteredReleases = append(filteredReleases, r)
}
}
Expand Down

0 comments on commit c4b5eb2

Please sign in to comment.