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

Function FilterCommentEvents

pkg/workflow/comment.go:103–119  ·  view source on GitHub ↗

FilterCommentEvents returns only the comment events specified by the identifiers If identifiers is nil or empty, returns all comment events

(identifiers []string)

Source from the content-addressed store, hash-verified

101// FilterCommentEvents returns only the comment events specified by the identifiers
102// If identifiers is nil or empty, returns all comment events
103func FilterCommentEvents(identifiers []string) []CommentEventMapping {
104 // len() for nil slices returns 0, so this handles both nil and empty slices
105 if len(identifiers) == 0 {
106 commentLog.Print("Filtering comment events: no identifiers specified, returning all events")
107 return GetAllCommentEvents()
108 }
109
110 commentLog.Printf("Filtering comment events: %d identifiers specified", len(identifiers))
111 var result []CommentEventMapping
112 for _, identifier := range identifiers {
113 if mapping := GetCommentEventByIdentifier(identifier); mapping != nil {
114 result = append(result, *mapping)
115 }
116 }
117
118 return result
119}
120
121// GetCommentEventNames returns just the event names from a list of mappings
122func GetCommentEventNames(mappings []CommentEventMapping) []string {

Calls 4

GetAllCommentEventsFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45

Tested by 1

TestFilterCommentEventsFunction · 0.68