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)
| 458 | // ImportCache so callers that check multiple workflows can avoid creating a new cache |
| 459 | // on every call. |
| 460 | func 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) |
| 485 | func fetchLatestRunsByRef(ref string, repoOverride string, verbose bool) (map[string]*WorkflowRun, error) { |
no test coverage detected