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

Function pruneOrphanedActionCacheEntries

pkg/cli/compile_post_processing.go:324–342  ·  view source on GitHub ↗

pruneOrphanedActionCacheEntries removes entries from the action cache that were not referenced during the current compilation run. This garbage-collects entries for action versions no longer used by any workflow in the target directory (e.g. old version pins left behind after bumping a `uses:` tag).

(compiler *workflow.Compiler, actionCache *workflow.ActionCache, errorCount int)

Source from the content-addressed store, hash-verified

322// subset of files would incorrectly prune entries still referenced by other
323// (uncompiled) workflows — and only when there were zero compile errors.
324func pruneOrphanedActionCacheEntries(compiler *workflow.Compiler, actionCache *workflow.ActionCache, errorCount int) {
325 if actionCache == nil {
326 return
327 }
328 if errorCount > 0 {
329 return
330 }
331
332 resolver := compiler.GetSharedActionResolver()
333 if resolver == nil {
334 return
335 }
336
337 usedKeys := resolver.GetUsedCacheKeys()
338 pruned := actionCache.PruneOrphanedEntries(usedKeys)
339 if pruned > 0 {
340 compilePostProcessingLog.Printf("Pruned %d orphaned entries from actions-lock.json", pruned)
341 }
342}

Callers 1

Calls 4

GetUsedCacheKeysMethod · 0.80
PruneOrphanedEntriesMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected