MCPcopy Create free account
hub / github.com/github/gh-aw / GetObjectiveLabels

Method GetObjectiveLabels

pkg/github/label_objective_mapping.go:193–207  ·  view source on GitHub ↗

GetObjectiveLabels returns the subset of issue labels that have objective values. Also returns the labels in the order they appear in the issue's label list.

(issueLabels []string)

Source from the content-addressed store, hash-verified

191// GetObjectiveLabels returns the subset of issue labels that have objective values.
192// Also returns the labels in the order they appear in the issue's label list.
193func (om *ObjectiveMapping) GetObjectiveLabels(issueLabels []string) []string {
194 if om == nil || len(om.LabelToValue) == 0 {
195 return []string{}
196 }
197
198 result := make([]string, 0)
199 for _, label := range issueLabels {
200 normalizedLabel := strings.ToLower(strings.TrimSpace(label))
201 if _, ok := om.LabelToValue[normalizedLabel]; ok {
202 result = append(result, label)
203 }
204 }
205
206 return result
207}
208
209// MarshalJSON implements json.Marshaler to ensure consistent output.
210func (om *ObjectiveMapping) MarshalJSON() ([]byte, error) {

Calls 1

ToLowerMethod · 0.80