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

Function parseCacheMemoryIdentity

pkg/workflow/cache.go:149–168  ·  view source on GitHub ↗
(cacheMap map[string]any, defaultID string, entry *CacheMemoryEntry)

Source from the content-addressed store, hash-verified

147}
148
149func parseCacheMemoryIdentity(cacheMap map[string]any, defaultID string, entry *CacheMemoryEntry) error {
150 if idStr, ok := cacheMap["id"].(string); ok {
151 if idStr != "default" && !isValidCacheID(idStr) {
152 return fmt.Errorf("invalid cache-memory id %q: must contain only letters, digits, underscores, or hyphens (1-64 characters)", idStr)
153 }
154 entry.ID = idStr
155 }
156 if entry.ID != defaultID {
157 entry.Key = generateDefaultCacheKey(entry.ID)
158 }
159 keyStr, ok := cacheMap["key"].(string)
160 if !ok {
161 return nil
162 }
163 if err := validateNoCacheKeyRunID(keyStr); err != nil {
164 return err
165 }
166 entry.Key = ensureCacheRunIDSuffix(keyStr)
167 return nil
168}
169
170func ensureCacheRunIDSuffix(key string) string {
171 runIdSuffix := "-${{ github.run_id }}"

Callers 1

parseCacheMemoryEntryFunction · 0.85

Calls 5

isValidCacheIDFunction · 0.85
generateDefaultCacheKeyFunction · 0.85
validateNoCacheKeyRunIDFunction · 0.85
ensureCacheRunIDSuffixFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected