recompileAllWorkflows recompiles all .md workflow files in the given directory. This is used after container pin updates to embed digest-pinned image references in the generated lock files.
(ctx context.Context, workflowsDir, engineOverride string, verbose bool)
| 251 | // This is used after container pin updates to embed digest-pinned image references |
| 252 | // in the generated lock files. |
| 253 | func recompileAllWorkflows(ctx context.Context, workflowsDir, engineOverride string, verbose bool) error { |
| 254 | if workflowsDir == "" { |
| 255 | workflowsDir = getWorkflowsDir() |
| 256 | } |
| 257 | |
| 258 | entries, err := os.ReadDir(workflowsDir) |
| 259 | if err != nil { |
| 260 | return fmt.Errorf("failed to read workflows directory: %w", err) |
| 261 | } |
| 262 | |
| 263 | for _, entry := range entries { |
| 264 | if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".md") { |
| 265 | continue |
| 266 | } |
| 267 | path := filepath.Join(workflowsDir, entry.Name()) |
| 268 | if err := compileWorkflowWithRefresh(ctx, path, verbose, true, engineOverride, false); err != nil { |
| 269 | if verbose { |
| 270 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to recompile %s: %v", entry.Name(), err))) |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | return nil |
| 275 | } |
| 276 | |
| 277 | func runUpdateForTargetRepo(ctx context.Context, targetRepo string, opts UpdateWorkflowsOptions, createPR bool, verbose bool) error { |
| 278 | gitRoot, err := gitutil.FindGitRoot() |
no test coverage detected