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

Function compileWorkflowWithRefresh

pkg/cli/add_workflow_compilation.go:27–56  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

25// compileWorkflowWithRefresh compiles a workflow file with optional stop time refresh.
26// This function handles the compilation process and ensures .gitattributes is updated.
27func 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.

Callers 7

recompileAllWorkflowsFunction · 0.85
compileWorkflowFunction · 0.85
updateWorkflowFunction · 0.85

Calls 10

SetRefreshStopTimeMethod · 0.95
SetQuietMethod · 0.95
NewCompilerFunction · 0.92
WithVerboseFunction · 0.92
WithEngineOverrideFunction · 0.92
FormatWarningMessageFunction · 0.92
ensureGitAttributesFunction · 0.85
PrintMethod · 0.80
PrintfMethod · 0.45

Tested by 1