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)
| 322 | // subset of files would incorrectly prune entries still referenced by other |
| 323 | // (uncompiled) workflows — and only when there were zero compile errors. |
| 324 | func 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 | } |
no test coverage detected