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

Function parseCacheStepConfigs

pkg/workflow/cache.go:388–406  ·  view source on GitHub ↗
(cacheYAML string)

Source from the content-addressed store, hash-verified

386}
387
388func parseCacheStepConfigs(cacheYAML string) ([]map[string]any, error) {
389 var topLevel map[string]any
390 if err := yaml.Unmarshal([]byte(cacheYAML), &topLevel); err != nil {
391 return nil, err
392 }
393 cacheConfig, exists := topLevel["cache"]
394 if !exists {
395 return nil, errors.New("no cache key found in parsed configuration")
396 }
397 if cacheArray, isArray := cacheConfig.([]any); isArray {
398 cacheLog.Printf("Processing %d cache entries (array format)", len(cacheArray))
399 return normalizeCacheStepArray(cacheArray), nil
400 }
401 if cacheMap, isMap := cacheConfig.(map[string]any); isMap {
402 cacheLog.Print("Processing single cache entry (object format)")
403 return []map[string]any{cacheMap}, nil
404 }
405 return nil, nil
406}
407
408func normalizeCacheStepArray(cacheArray []any) []map[string]any {
409 caches := make([]map[string]any, 0, len(cacheArray))

Callers 1

generateCacheStepsFunction · 0.85

Calls 3

normalizeCacheStepArrayFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected