compileWorkflowWithRefresh compiles a workflow file with optional stop time refresh. This function handles the compilation process and ensures .gitattributes is updated.
(ctx context.Context, filePath string, verbose bool, quiet bool, engineOverride string, refreshStopTime bool)
| 25 | // compileWorkflowWithRefresh compiles a workflow file with optional stop time refresh. |
| 26 | // This function handles the compilation process and ensures .gitattributes is updated. |
| 27 | func compileWorkflowWithRefresh(ctx context.Context, filePath string, verbose bool, quiet bool, engineOverride string, refreshStopTime bool) error { |
| 28 | addWorkflowCompilationLog.Printf("Compiling workflow: file=%s, refresh_stop_time=%v, engine=%s", filePath, refreshStopTime, engineOverride) |
| 29 | |
| 30 | // Create compiler with auto-detected version and action mode |
| 31 | compiler := workflow.NewCompiler( |
| 32 | workflow.WithVerbose(verbose), |
| 33 | workflow.WithEngineOverride(engineOverride), |
| 34 | ) |
| 35 | |
| 36 | compiler.SetRefreshStopTime(refreshStopTime) |
| 37 | compiler.SetQuiet(quiet) |
| 38 | if err := CompileWorkflowWithValidation(ctx, compiler, filePath, CompileValidationOptions{Verbose: verbose}); err != nil { |
| 39 | addWorkflowCompilationLog.Printf("Compilation failed: %v", err) |
| 40 | return err |
| 41 | } |
| 42 | |
| 43 | addWorkflowCompilationLog.Print("Compilation completed successfully") |
| 44 | |
| 45 | // Ensure .gitattributes marks .lock.yml files as generated |
| 46 | if _, err := ensureGitAttributes(); err != nil { |
| 47 | if verbose { |
| 48 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to update .gitattributes: %v", err))) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // Note: Instructions are only written when explicitly requested via the compile command flag |
| 53 | // This helper function is used in contexts where instructions should not be automatically written |
| 54 | |
| 55 | return nil |
| 56 | } |
| 57 | |
| 58 | // compileWorkflowWithTracking compiles a workflow and tracks generated files. |
| 59 | // This is a convenience wrapper around compileWorkflowWithTrackingAndRefresh. |