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

Method parseUpdateEntityBase

pkg/workflow/update_entity_helpers.go:171–198  ·  view source on GitHub ↗

parseUpdateEntityBase is a helper that reduces scaffolding duplication across update entity parsers. It handles the common pattern of: 1. Building UpdateEntityJobParams 2. Calling parseUpdateEntityConfig 3. Checking for nil result 4. Returning the base config and config map for entity-specific field

(
	outputMap map[string]any,
	entityType UpdateEntityType,
	configKey string,
	logger *logger.Logger,
)

Source from the content-addressed store, hash-verified

169//
170// Callers should check if baseConfig is nil before proceeding with entity-specific parsing.
171func (c *Compiler) parseUpdateEntityBase(
172 outputMap map[string]any,
173 entityType UpdateEntityType,
174 configKey string,
175 logger *logger.Logger,
176) (*UpdateEntityConfig, map[string]any) {
177 // Build params for base config parsing
178 params := UpdateEntityJobParams{
179 EntityType: entityType,
180 ConfigKey: configKey,
181 }
182
183 // Parse the base config (common fields like max, target, target-repo)
184 baseConfig := c.parseUpdateEntityConfig(outputMap, params, logger, nil)
185 if baseConfig == nil {
186 return nil, nil
187 }
188
189 // Extract the config map for entity-specific field parsing
190 var configMap map[string]any
191 if configData, exists := outputMap[configKey]; exists {
192 if cm, ok := configData.(map[string]any); ok {
193 configMap = cm
194 }
195 }
196
197 return baseConfig, configMap
198}
199
200// FieldParsingMode determines how boolean fields are parsed from the config
201type FieldParsingMode int

Callers 1

Calls 1

Tested by

no test coverage detected