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

Function pruneStaleActionCacheEntries

pkg/cli/compile_post_processing.go:300–314  ·  view source on GitHub ↗

pruneStaleActionCacheEntries removes stale gh-aw-actions entries from the action cache whose version does not match the compiler's current version. This prevents actions-lock.json from accumulating entries for old compiler releases that are no longer referenced by any compiled workflow.

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

Source from the content-addressed store, hash-verified

298// This prevents actions-lock.json from accumulating entries for old compiler
299// releases that are no longer referenced by any compiled workflow.
300func pruneStaleActionCacheEntries(compiler *workflow.Compiler, actionCache *workflow.ActionCache) {
301 if actionCache == nil {
302 return
303 }
304
305 // Determine the effective version: actionTag takes precedence when explicitly
306 // set (e.g., via --action-tag for testing against a specific release), otherwise
307 // fall back to the compiler's built-in version from the binary.
308 version := compiler.GetActionTag()
309 if version == "" {
310 version = compiler.GetVersion()
311 }
312
313 actionCache.PruneStaleGHAWEntries(version, compiler.EffectiveActionsRepo())
314}
315
316// pruneOrphanedActionCacheEntries removes entries from the action cache that were
317// not referenced during the current compilation run. This garbage-collects entries

Callers 3

runPostProcessingFunction · 0.85

Calls 4

GetActionTagMethod · 0.80
GetVersionMethod · 0.80
PruneStaleGHAWEntriesMethod · 0.80
EffectiveActionsRepoMethod · 0.80

Tested by

no test coverage detected