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

Function isCompiledUpToDateWithCache

pkg/cli/status_command.go:460–482  ·  view source on GitHub ↗

isCompiledUpToDateWithCache is the same as isCompiledUpToDate but accepts a shared ImportCache so callers that check multiple workflows can avoid creating a new cache on every call.

(workflowPath, lockFilePath string, cache *parser.ImportCache)

Source from the content-addressed store, hash-verified

458// ImportCache so callers that check multiple workflows can avoid creating a new cache
459// on every call.
460func isCompiledUpToDateWithCache(workflowPath, lockFilePath string, cache *parser.ImportCache) string {
461 lockContent, err := os.ReadFile(lockFilePath)
462 if err != nil {
463 return "No"
464 }
465
466 metadata, _, err := workflow.ExtractMetadataFromLockFile(string(lockContent))
467 if err != nil || metadata == nil || metadata.FrontmatterHash == "" {
468 // Legacy lock file without a hash — assume compiled to avoid false negatives
469 return "Yes"
470 }
471
472 currentHash, err := parser.ComputeFrontmatterHashFromFile(workflowPath, cache)
473 if err != nil {
474 statusLog.Printf("Failed to compute frontmatter hash for %s: %v", workflowPath, err)
475 return "Yes"
476 }
477
478 if currentHash == metadata.FrontmatterHash {
479 return "Yes"
480 }
481 return "No"
482}
483
484// fetchLatestRunsByRef fetches the latest workflow run for each workflow from a specific ref (branch or tag)
485func fetchLatestRunsByRef(ref string, repoOverride string, verbose bool) (map[string]*WorkflowRun, error) {

Callers 2

RunListWorkflowsFunction · 0.85
isCompiledUpToDateFunction · 0.85

Calls 3

PrintfMethod · 0.45

Tested by

no test coverage detected