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

Function buildDedupKeyInfos

pkg/workflow/action_cache.go:632–653  ·  view source on GitHub ↗
(keys []string)

Source from the content-addressed store, hash-verified

630}
631
632func buildDedupKeyInfos(keys []string) []cacheKeyInfo {
633 keyInfos := make([]cacheKeyInfo, len(keys))
634 for i, key := range keys {
635 parts := strings.SplitN(key, "@", 2)
636 versionRef := ""
637 if len(parts) == 2 {
638 versionRef = parts[1]
639 }
640 keyInfos[i] = cacheKeyInfo{key: key, versionRef: versionRef}
641 }
642 slices.SortFunc(keyInfos, func(a, b cacheKeyInfo) int {
643 switch {
644 case semverutil.IsMorePreciseVersion(a.versionRef, b.versionRef):
645 return -1
646 case semverutil.IsMorePreciseVersion(b.versionRef, a.versionRef):
647 return 1
648 default:
649 return 0
650 }
651 })
652 return keyInfos
653}
654
655func collectDedupRemovals(keyInfos []cacheKeyInfo) (string, []string, []string) {
656 keepVersion := keyInfos[0].versionRef

Callers 1

deduplicateEntriesMethod · 0.85

Calls 1

IsMorePreciseVersionFunction · 0.92

Tested by

no test coverage detected