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

Function mergeEventConfig

pkg/workflow/trigger_parser.go:730–747  ·  view source on GitHub ↗
(existing any, incoming any)

Source from the content-addressed store, hash-verified

728}
729
730func mergeEventConfig(existing any, incoming any) any {
731 existingMap, existingOK := existing.(map[string]any)
732 incomingMap, incomingOK := incoming.(map[string]any)
733 if !existingOK || !incomingOK {
734 return incoming
735 }
736 merged := maps.Clone(existingMap)
737 maps.Copy(merged, incomingMap)
738
739 existingTypes, existingTypesOK := parseEventTypes(existingMap["types"])
740 incomingTypes, incomingTypesOK := parseEventTypes(incomingMap["types"])
741 if existingTypesOK && incomingTypesOK {
742 combined := sliceutil.MergeUnique(existingTypes, incomingTypes...)
743 merged["types"] = combined
744 }
745
746 return merged
747}
748
749func parseEventTypes(value any) ([]string, bool) {
750 switch typed := value.(type) {

Callers 1

mergeCommandOtherEventsFunction · 0.85

Calls 3

MergeUniqueFunction · 0.92
parseEventTypesFunction · 0.85
CloneMethod · 0.45

Tested by

no test coverage detected