(cacheMap map[string]any, defaultID string, entry *CacheMemoryEntry)
| 147 | } |
| 148 | |
| 149 | func 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 | |
| 170 | func ensureCacheRunIDSuffix(key string) string { |
| 171 | runIdSuffix := "-${{ github.run_id }}" |
no test coverage detected