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

Method FindAnyEntryForRepo

pkg/workflow/action_cache.go:409–427  ·  view source on GitHub ↗

FindAnyEntryForRepo finds any cache entry for the given repo, preferring the newest version (by sorting keys and taking first match). Returns the cache key, entry, and true if found, or empty values and false if not found. This is used when the compiler needs to reference an action but doesn't know

(repo string)

Source from the content-addressed store, hash-verified

407// Returns the cache key, entry, and true if found, or empty values and false if not found.
408// This is used when the compiler needs to reference an action but doesn't know the version.
409func (c *ActionCache) FindAnyEntryForRepo(repo string) (string, ActionCacheEntry, bool) {
410 prefix := repo + "@"
411 var matchedKeys []string
412 for key := range c.Entries {
413 if strings.HasPrefix(key, prefix) {
414 matchedKeys = append(matchedKeys, key)
415 }
416 }
417 if len(matchedKeys) == 0 {
418 actionCacheLog.Printf("No cache entries found for repo: %s", repo)
419 return "", ActionCacheEntry{}, false
420 }
421 // Sort keys and take the first one (lexicographically, which tends to favor newer versions)
422 sort.Strings(matchedKeys)
423 firstKey := matchedKeys[len(matchedKeys)-1] // Take the last one for descending order (v9 > v1)
424 entry := c.Entries[firstKey]
425 actionCacheLog.Printf("Found cache entry for %s: %s", repo, firstKey)
426 return firstKey, entry, true
427}
428
429// Set stores a new cache entry, preserving any already-cached inputs when the SHA
430// is unchanged. If the SHA changes (e.g. a moving tag points to a new commit),

Callers 2

getActionPinMethod · 0.80

Calls 1

PrintfMethod · 0.45

Tested by

no test coverage detected