createAndConfigureCompiler creates a new compiler instance and configures it based on the provided configuration
(config CompileConfig)
| 82 | // createAndConfigureCompiler creates a new compiler instance and configures it |
| 83 | // based on the provided configuration |
| 84 | func createAndConfigureCompiler(config CompileConfig) *workflow.Compiler { |
| 85 | compileCompilerSetupLog.Printf("Creating compiler with config: verbose=%v, validate=%v, strict=%v, trialMode=%v", |
| 86 | config.Verbose, config.Validate, config.Strict, config.TrialMode) |
| 87 | |
| 88 | // Handle force refresh action pins - reset the source action_pins.json file |
| 89 | if config.ForceRefreshActionPins { |
| 90 | if err := resetActionPinsFile(); err != nil { |
| 91 | compileCompilerSetupLog.Printf("Warning: failed to reset action_pins.json: %v", err) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // Create compiler with auto-detected version and action mode |
| 96 | // Git root is now auto-detected in NewCompiler() for all compiler instances |
| 97 | compiler := workflow.NewCompiler( |
| 98 | workflow.WithVerbose(config.Verbose), |
| 99 | workflow.WithEngineOverride(config.EngineOverride), |
| 100 | workflow.WithFailFast(config.FailFast), |
| 101 | ) |
| 102 | compileCompilerSetupLog.Print("Created compiler instance") |
| 103 | |
| 104 | // Configure compiler flags |
| 105 | configureCompilerFlags(compiler, config) |
| 106 | |
| 107 | // Set up action mode |
| 108 | setupActionMode(compiler, config.ActionMode, config.ActionTag) |
| 109 | |
| 110 | // Set up actions repository override if specified |
| 111 | if config.ActionsRepo != "" { |
| 112 | compiler.SetActionsRepo(config.ActionsRepo) |
| 113 | compileCompilerSetupLog.Printf("Actions repository overridden: %s (default: %s)", config.ActionsRepo, workflow.GitHubActionsOrgRepo) |
| 114 | } |
| 115 | |
| 116 | // Set up repository context |
| 117 | setupRepositoryContext(compiler, config) |
| 118 | |
| 119 | return compiler |
| 120 | } |
| 121 | |
| 122 | // configureCompilerFlags sets various compilation flags on the compiler |
| 123 | func configureCompilerFlags(compiler *workflow.Compiler, config CompileConfig) { |
no test coverage detected