CanonicalizeIssueLabels returns the deterministic representation stored in issue payloads.
(labels []string)
| 32 | |
| 33 | // CanonicalizeIssueLabels returns the deterministic representation stored in issue payloads. |
| 34 | func CanonicalizeIssueLabels(labels []string) []string { |
| 35 | if len(labels) == 0 { |
| 36 | return nil |
| 37 | } |
| 38 | |
| 39 | canonicalLabels := make([]string, 0, len(labels)) |
| 40 | for _, label := range labels { |
| 41 | label = strings.TrimSpace(label) |
| 42 | if label == "" { |
| 43 | continue |
| 44 | } |
| 45 | canonicalLabels = append(canonicalLabels, label) |
| 46 | } |
| 47 | if len(canonicalLabels) == 0 { |
| 48 | return nil |
| 49 | } |
| 50 | |
| 51 | slices.Sort(canonicalLabels) |
| 52 | return slices.Compact(canonicalLabels) |
| 53 | } |
| 54 | |
| 55 | // IssueMessage is the mssage for issues. |
| 56 | type IssueMessage struct { |
no outgoing calls