2
0

sanitize.go 394 B

12345678910111213
  1. package utils
  2. import (
  3. "fmt"
  4. "strings"
  5. )
  6. // SlugifyRepoSuffix return a sanitized repository name based on a Git repo owner and name.
  7. func SlugifyRepoSuffix(repoOwner, repoName string) string {
  8. initialSuffix := fmt.Sprintf("%s-%s", repoOwner, repoName)
  9. sanitizedSuffix := strings.ReplaceAll(strings.ReplaceAll(initialSuffix, "_", "-"), ".", "-")
  10. return strings.ToLower(sanitizedSuffix)
  11. }