From 7e2f6dc63f425d98bbc5f03a2558dfde54d46e9a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 12:13:11 +0000 Subject: [PATCH] chore: remove dead NewCompilerWithVersion, add WithVersion option Replace deprecated NewCompilerWithVersion(v) with NewCompiler(WithVersion(v)) across all test files. Add WithVersion functional option to compiler_types.go so callers can set version through the standard options pattern. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/workflow/action_reference_test.go | 6 +- pkg/workflow/activation_checkout_test.go | 2 +- pkg/workflow/allow_github_references_test.go | 2 +- pkg/workflow/assign_to_agent_test.go | 2 +- pkg/workflow/aw_info_versions_test.go | 10 +-- .../blocked_domains_integration_test.go | 10 +-- .../call_workflow_compilation_test.go | 10 +-- .../call_workflow_permissions_test.go | 12 ++-- pkg/workflow/call_workflow_test.go | 10 +-- pkg/workflow/call_workflow_validation_test.go | 14 ++-- pkg/workflow/checkout_import_test.go | 10 +-- pkg/workflow/compiler_activation_job_test.go | 22 +++---- pkg/workflow/compiler_cache_test.go | 2 +- pkg/workflow/compiler_custom_actions_test.go | 16 ++--- pkg/workflow/compiler_types.go | 15 ++--- pkg/workflow/compiler_validation_test.go | 2 +- .../compiler_yaml_error_wrapping_test.go | 6 +- pkg/workflow/dispatch_repository_test.go | 32 +++++----- pkg/workflow/dispatch_workflow_test.go | 14 ++-- .../dispatch_workflow_validation_test.go | 12 ++-- pkg/workflow/error_wrapping_test.go | 14 ++-- .../firewall_args_integration_test.go | 10 +-- pkg/workflow/firewall_workflow_test.go | 2 +- pkg/workflow/github_mcp_app_token_test.go | 24 +++---- pkg/workflow/local_action_permissions_test.go | 4 +- .../permissions_explicit_empty_test.go | 2 +- .../safe_jobs_threat_detection_test.go | 8 +-- .../safe_outputs_allow_workflows_test.go | 8 +-- pkg/workflow/safe_outputs_app_import_test.go | 4 +- pkg/workflow/safe_outputs_app_test.go | 8 +-- .../safe_outputs_call_workflow_test.go | 16 ++--- pkg/workflow/safe_outputs_default_max_test.go | 8 +-- pkg/workflow/safe_outputs_fix_test.go | 4 +- pkg/workflow/safe_outputs_import_test.go | 64 +++++++++---------- .../top_level_github_app_import_test.go | 30 ++++----- 35 files changed, 205 insertions(+), 210 deletions(-) diff --git a/pkg/workflow/action_reference_test.go b/pkg/workflow/action_reference_test.go index 5fb2ce34ab3..cfa93494c6c 100644 --- a/pkg/workflow/action_reference_test.go +++ b/pkg/workflow/action_reference_test.go @@ -88,7 +88,7 @@ func TestConvertToRemoteActionRef(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion(tt.version) + compiler := NewCompiler(WithVersion(tt.version)) var data *WorkflowData if !tt.nilData { @@ -177,7 +177,7 @@ func TestResolveActionReference(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion(tt.version) + compiler := NewCompiler(WithVersion(tt.version)) compiler.SetActionMode(tt.actionMode) data := &WorkflowData{} @@ -245,7 +245,7 @@ func TestCompilerActionTag(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion(tt.version) + compiler := NewCompiler(WithVersion(tt.version)) compiler.SetActionMode(ActionModeRelease) if tt.compilerActionTag != "" { compiler.SetActionTag(tt.compilerActionTag) diff --git a/pkg/workflow/activation_checkout_test.go b/pkg/workflow/activation_checkout_test.go index 0a75ec48e55..e7b884750ea 100644 --- a/pkg/workflow/activation_checkout_test.go +++ b/pkg/workflow/activation_checkout_test.go @@ -74,7 +74,7 @@ strict: false t.Fatal(err) } - compiler := NewCompilerWithVersion("dev") + compiler := NewCompiler(WithVersion("dev")) // Use dev mode to use local action paths compiler.SetActionMode(ActionModeDev) diff --git a/pkg/workflow/allow_github_references_test.go b/pkg/workflow/allow_github_references_test.go index fc7921cdc44..211e2e590b2 100644 --- a/pkg/workflow/allow_github_references_test.go +++ b/pkg/workflow/allow_github_references_test.go @@ -98,7 +98,7 @@ func TestAllowGitHubReferencesConfig(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - c := NewCompilerWithVersion("1.0.0") + c := NewCompiler(WithVersion("1.0.0")) config := c.extractSafeOutputsConfig(tt.frontmatter) require.NotNil(t, config, "extractSafeOutputsConfig() should not return nil") diff --git a/pkg/workflow/assign_to_agent_test.go b/pkg/workflow/assign_to_agent_test.go index 82d877d25d8..78d39c191ce 100644 --- a/pkg/workflow/assign_to_agent_test.go +++ b/pkg/workflow/assign_to_agent_test.go @@ -34,7 +34,7 @@ This workflow tests canonical 'name' key. err := os.WriteFile(testFile, []byte(workflow), 0644) require.NoError(t, err, "Failed to write test workflow") - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData, err := compiler.ParseWorkflowFile(testFile) require.NoError(t, err, "Failed to parse workflow") diff --git a/pkg/workflow/aw_info_versions_test.go b/pkg/workflow/aw_info_versions_test.go index 5f25b082a22..9c85cb105dc 100644 --- a/pkg/workflow/aw_info_versions_test.go +++ b/pkg/workflow/aw_info_versions_test.go @@ -125,7 +125,7 @@ func TestCLIVersionInAwInfo(t *testing.T) { // Set the release flag for this test SetIsRelease(tt.isRelease) - compiler := NewCompilerWithVersion(tt.cliVersion) + compiler := NewCompiler(WithVersion(tt.cliVersion)) registry := GetGlobalEngineRegistry() engine, err := registry.GetEngine(tt.engineID) if err != nil { @@ -192,7 +192,7 @@ func TestAwfVersionInAwInfo(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) registry := GetGlobalEngineRegistry() engine, err := registry.GetEngine("copilot") if err != nil { @@ -234,7 +234,7 @@ func TestBothVersionsInAwInfo(t *testing.T) { SetIsRelease(true) // Test that both CLI version and AWF version are present simultaneously - compiler := NewCompilerWithVersion("2.0.0-beta.5") + compiler := NewCompiler(WithVersion("2.0.0-beta.5")) registry := GetGlobalEngineRegistry() engine, err := registry.GetEngine("copilot") if err != nil { @@ -297,7 +297,7 @@ func TestAwmgVersionInAwInfo(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) registry := GetGlobalEngineRegistry() engine, err := registry.GetEngine("copilot") if err != nil { @@ -338,7 +338,7 @@ func TestAllVersionsInAwInfo(t *testing.T) { SetIsRelease(true) // Test that CLI version, AWF version, and AWMG version are present simultaneously - compiler := NewCompilerWithVersion("2.0.0-beta.5") + compiler := NewCompiler(WithVersion("2.0.0-beta.5")) registry := GetGlobalEngineRegistry() engine, err := registry.GetEngine("copilot") if err != nil { diff --git a/pkg/workflow/blocked_domains_integration_test.go b/pkg/workflow/blocked_domains_integration_test.go index ea14f649149..7292a5e7302 100644 --- a/pkg/workflow/blocked_domains_integration_test.go +++ b/pkg/workflow/blocked_domains_integration_test.go @@ -50,7 +50,7 @@ Test workflow with blocked domains. } // Compile the workflow - compiler := NewCompilerWithVersion("test-blocked-domains") + compiler := NewCompiler(WithVersion("test-blocked-domains")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { @@ -126,7 +126,7 @@ Test workflow with blocked ecosystem. } // Compile the workflow - compiler := NewCompilerWithVersion("test-blocked-ecosystem") + compiler := NewCompiler(WithVersion("test-blocked-ecosystem")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { @@ -195,7 +195,7 @@ Test workflow without blocked domains. } // Compile the workflow - compiler := NewCompilerWithVersion("test-no-blocked") + compiler := NewCompiler(WithVersion("test-no-blocked")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { @@ -257,7 +257,7 @@ Test Claude workflow with blocked domains. } // Compile the workflow - compiler := NewCompilerWithVersion("test-claude-blocked") + compiler := NewCompiler(WithVersion("test-claude-blocked")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { @@ -319,7 +319,7 @@ Test Codex workflow with blocked domains. } // Compile the workflow - compiler := NewCompilerWithVersion("test-codex-blocked") + compiler := NewCompiler(WithVersion("test-codex-blocked")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { diff --git a/pkg/workflow/call_workflow_compilation_test.go b/pkg/workflow/call_workflow_compilation_test.go index 2323561f581..3d72fe0215e 100644 --- a/pkg/workflow/call_workflow_compilation_test.go +++ b/pkg/workflow/call_workflow_compilation_test.go @@ -66,7 +66,7 @@ func compileAndReadLock(t *testing.T, gatewayFile, markdown string) string { err := os.WriteFile(gatewayFile, []byte(markdown), 0644) require.NoError(t, err, "Failed to write gateway markdown") - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err = compiler.CompileWorkflow(gatewayFile) require.NoError(t, err, "Compilation should succeed") @@ -476,7 +476,7 @@ safe-outputs: gatewayFile := filepath.Join(workflowsDir, "gateway.md") require.NoError(t, os.WriteFile(gatewayFile, []byte(gatewayMD), 0644)) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err = compiler.CompileWorkflow(gatewayFile) require.Error(t, err, "Should fail when worker lacks workflow_call trigger") assert.Contains(t, err.Error(), "workflow_call", "Error should mention workflow_call") @@ -506,7 +506,7 @@ safe-outputs: gatewayFile := filepath.Join(workflowsDir, "gateway.md") require.NoError(t, os.WriteFile(gatewayFile, []byte(gatewayMD), 0644)) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err := compiler.CompileWorkflow(gatewayFile) require.Error(t, err, "Should fail for self-reference") assert.Contains(t, err.Error(), "self-reference", "Error should mention self-reference") @@ -535,7 +535,7 @@ safe-outputs: gatewayFile := filepath.Join(workflowsDir, "gateway.md") require.NoError(t, os.WriteFile(gatewayFile, []byte(gatewayMD), 0644)) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err := compiler.CompileWorkflow(gatewayFile) require.Error(t, err, "Should fail for missing worker") assert.Contains(t, err.Error(), "not found", "Error should mention not found") @@ -570,7 +570,7 @@ safe-outputs: gatewayFile := filepath.Join(workflowsDir, "gateway.md") require.NoError(t, os.WriteFile(gatewayFile, []byte(gatewayMD), 0644)) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err := compiler.CompileWorkflow(gatewayFile) require.Error(t, err, "Should fail for duplicate workflow name") assert.Contains(t, err.Error(), "duplicate", "Error should mention duplicate") diff --git a/pkg/workflow/call_workflow_permissions_test.go b/pkg/workflow/call_workflow_permissions_test.go index 066db77ff2c..f4d939d304a 100644 --- a/pkg/workflow/call_workflow_permissions_test.go +++ b/pkg/workflow/call_workflow_permissions_test.go @@ -222,7 +222,7 @@ func TestExtractCallWorkflowPermissions_FileNotFound(t *testing.T) { // TestBuildCallWorkflowJobs_SetsPermissionsFromLockYML tests that call-workflow jobs // include permissions extracted from the worker's .lock.yml file func TestBuildCallWorkflowJobs_SetsPermissionsFromLockYML(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -281,7 +281,7 @@ jobs: // TestBuildCallWorkflowJobs_SetsPermissionsFromMD tests that call-workflow jobs // include permissions from .md frontmatter for same-batch compilation targets func TestBuildCallWorkflowJobs_SetsPermissionsFromMD(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -329,7 +329,7 @@ permissions: // TestBuildCallWorkflowJobs_NoPermissionsWhenWorkerHasNone tests that call-workflow // jobs omit the permissions block when the worker's jobs have no permissions func TestBuildCallWorkflowJobs_NoPermissionsWhenWorkerHasNone(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -373,7 +373,7 @@ jobs: // TestCallWorkflowJobYAMLOutput_WithPermissions tests the YAML output of a call-workflow // job includes the permissions block derived from the worker's .lock.yml func TestCallWorkflowJobYAMLOutput_WithPermissions(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -474,7 +474,7 @@ jobs: // TestCallWorkflowPermissions_EndToEnd tests full gateway compilation with permissioned workers — // the generated lock file must include job-level permissions blocks on every call-* job. func TestCallWorkflowPermissions_EndToEnd(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -599,7 +599,7 @@ Analyse the issue and determine which worker to run. // TestCallWorkflowPermissions_EndToEnd_YMLWorker tests that a worker referenced via a .yml // file (not .lock.yml) also gets its permissions propagated in the generated call-* job. func TestCallWorkflowPermissions_EndToEnd_YMLWorker(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") diff --git a/pkg/workflow/call_workflow_test.go b/pkg/workflow/call_workflow_test.go index 3cfd53b74b2..69c33ab2235 100644 --- a/pkg/workflow/call_workflow_test.go +++ b/pkg/workflow/call_workflow_test.go @@ -11,7 +11,7 @@ import ( // TestParseCallWorkflowConfig_ArrayFormat tests parsing call-workflow with array format func TestParseCallWorkflowConfig_ArrayFormat(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "call-workflow": []any{"worker-a", "worker-b", "worker-c"}, @@ -25,7 +25,7 @@ func TestParseCallWorkflowConfig_ArrayFormat(t *testing.T) { // TestParseCallWorkflowConfig_MapFormat tests parsing call-workflow with map format func TestParseCallWorkflowConfig_MapFormat(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "call-workflow": map[string]any{ @@ -42,7 +42,7 @@ func TestParseCallWorkflowConfig_MapFormat(t *testing.T) { // TestParseCallWorkflowConfig_DefaultMax tests that max defaults to 1 func TestParseCallWorkflowConfig_DefaultMax(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "call-workflow": map[string]any{ @@ -57,7 +57,7 @@ func TestParseCallWorkflowConfig_DefaultMax(t *testing.T) { // TestParseCallWorkflowConfig_MaxCap tests that max is capped at 50 func TestParseCallWorkflowConfig_MaxCap(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "call-workflow": map[string]any{ @@ -73,7 +73,7 @@ func TestParseCallWorkflowConfig_MaxCap(t *testing.T) { // TestParseCallWorkflowConfig_NotPresent tests that nil is returned when call-workflow is not configured func TestParseCallWorkflowConfig_NotPresent(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{} diff --git a/pkg/workflow/call_workflow_validation_test.go b/pkg/workflow/call_workflow_validation_test.go index e0b47df7ff4..7e9f56eca6a 100644 --- a/pkg/workflow/call_workflow_validation_test.go +++ b/pkg/workflow/call_workflow_validation_test.go @@ -13,7 +13,7 @@ import ( // TestValidateCallWorkflow_EmptyList tests that empty workflow list returns an error func TestValidateCallWorkflow_EmptyList(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -40,7 +40,7 @@ func TestValidateCallWorkflow_EmptyList(t *testing.T) { // TestValidateCallWorkflow_NoConfig tests that nil config passes validation func TestValidateCallWorkflow_NoConfig(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData := &WorkflowData{ SafeOutputs: &SafeOutputsConfig{}, @@ -52,7 +52,7 @@ func TestValidateCallWorkflow_NoConfig(t *testing.T) { // TestValidateCallWorkflow_SelfReference tests that self-reference is rejected func TestValidateCallWorkflow_SelfReference(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -80,7 +80,7 @@ func TestValidateCallWorkflow_SelfReference(t *testing.T) { // TestValidateCallWorkflow_WorkflowNotFound tests that a missing workflow fails validation func TestValidateCallWorkflow_WorkflowNotFound(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -109,7 +109,7 @@ func TestValidateCallWorkflow_WorkflowNotFound(t *testing.T) { // TestValidateCallWorkflow_WorkflowWithoutWorkflowCall tests that a workflow missing // workflow_call trigger fails validation func TestValidateCallWorkflow_WorkflowWithoutWorkflowCall(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -154,7 +154,7 @@ jobs: // TestValidateCallWorkflow_ValidWorkflow tests that a valid worker passes validation func TestValidateCallWorkflow_ValidWorkflow(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -201,7 +201,7 @@ jobs: // TestValidateCallWorkflow_MDSourceWithWorkflowCall tests that a .md source with workflow_call // trigger passes validation (same-batch compilation target) func TestValidateCallWorkflow_MDSourceWithWorkflowCall(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") diff --git a/pkg/workflow/checkout_import_test.go b/pkg/workflow/checkout_import_test.go index a819cac8605..40a5c5bef4a 100644 --- a/pkg/workflow/checkout_import_test.go +++ b/pkg/workflow/checkout_import_test.go @@ -14,7 +14,7 @@ import ( // TestCheckoutImportFromSharedWorkflow tests that a checkout block defined in a shared // workflow is inherited by the importing workflow. func TestCheckoutImportFromSharedWorkflow(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -70,7 +70,7 @@ This workflow inherits the checkout configuration from the shared workflow. // TestCheckoutImportMainWorkflowTakesPrecedence tests that the main workflow's checkout // takes precedence over an imported checkout for the same (repository, path) key. func TestCheckoutImportMainWorkflowTakesPrecedence(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -131,7 +131,7 @@ This workflow overrides the checkout from the shared workflow. // TestCheckoutImportDisabledByMainWorkflow tests that checkout: false in the main workflow // suppresses imported checkout configs. func TestCheckoutImportDisabledByMainWorkflow(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -179,7 +179,7 @@ This workflow disables checkout entirely. // TestCheckoutImportMultipleImports tests that checkout configs from multiple shared // workflows are all merged into the importing workflow. func TestCheckoutImportMultipleImports(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -240,7 +240,7 @@ imports: // when an imported shared workflow defines conflicting auth for the same (repository, path). // A main workflow github-token must not be overridden by an imported github-app, and vice versa. func TestCheckoutImportAuthPrecedence(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") diff --git a/pkg/workflow/compiler_activation_job_test.go b/pkg/workflow/compiler_activation_job_test.go index 2b3d694d11e..b5f902b8b84 100644 --- a/pkg/workflow/compiler_activation_job_test.go +++ b/pkg/workflow/compiler_activation_job_test.go @@ -117,7 +117,7 @@ func TestGenerateCheckoutGitHubFolderForActivation_WorkflowCall(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - c := NewCompilerWithVersion("dev") + c := NewCompiler(WithVersion("dev")) c.SetActionMode(ActionModeDev) data := &WorkflowData{ @@ -250,7 +250,7 @@ func TestGenerateGitHubFolderCheckoutStep(t *testing.T) { // TestGenerateResolveHostRepoStep verifies that the resolve-host-repo step uses // job.workflow_* context fields to resolve the platform repository. func TestGenerateResolveHostRepoStep(t *testing.T) { - c := NewCompilerWithVersion("dev") + c := NewCompiler(WithVersion("dev")) c.SetActionMode(ActionModeDev) result := c.generateResolveHostRepoStep() @@ -275,7 +275,7 @@ func TestGenerateResolveHostRepoStep(t *testing.T) { // workflow_call triggers uses the resolve-host-repo step output instead of the // broken event_name == 'workflow_call' expression. func TestCheckoutDoesNotUseEventNameExpression(t *testing.T) { - c := NewCompilerWithVersion("dev") + c := NewCompiler(WithVersion("dev")) c.SetActionMode(ActionModeDev) data := &WorkflowData{ @@ -339,7 +339,7 @@ func TestActivationJobTargetRepoOutput(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion("dev") + compiler := NewCompiler(WithVersion("dev")) compiler.SetActionMode(ActionModeDev) data := &WorkflowData{ @@ -410,7 +410,7 @@ func TestActivationJobTargetRefOutput(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion("dev") + compiler := NewCompiler(WithVersion("dev")) compiler.SetActionMode(ActionModeDev) data := &WorkflowData{ @@ -482,7 +482,7 @@ func TestActivationJobTargetRepoNameOutput(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion("dev") + compiler := NewCompiler(WithVersion("dev")) compiler.SetActionMode(ActionModeDev) data := &WorkflowData{ @@ -553,7 +553,7 @@ func TestCheckoutGitHubFolderIncludesRef(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - c := NewCompilerWithVersion("dev") + c := NewCompiler(WithVersion("dev")) c.SetActionMode(ActionModeDev) data := &WorkflowData{ @@ -609,7 +609,7 @@ func TestGenerateCheckoutGitHubFolderForActivation_ActionsModeSetupPath(t *testi for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - c := NewCompilerWithVersion("dev") + c := NewCompiler(WithVersion("dev")) c.SetActionMode(tt.mode) data := &WorkflowData{ @@ -732,7 +732,7 @@ func TestCheckoutTokenPropagatedToActivation(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - c := NewCompilerWithVersion("dev") + c := NewCompiler(WithVersion("dev")) c.SetActionMode(ActionModeDev) data := &WorkflowData{ @@ -791,7 +791,7 @@ func TestCheckoutSameRepoGuardWithCustomToken(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - c := NewCompilerWithVersion("dev") + c := NewCompiler(WithVersion("dev")) c.SetActionMode(ActionModeDev) data := &WorkflowData{ @@ -837,7 +837,7 @@ func TestHashCheckTokenPropagation(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion("dev") + compiler := NewCompiler(WithVersion("dev")) compiler.SetActionMode(ActionModeDev) data := &WorkflowData{ diff --git a/pkg/workflow/compiler_cache_test.go b/pkg/workflow/compiler_cache_test.go index d457e452d81..69e8d7106dc 100644 --- a/pkg/workflow/compiler_cache_test.go +++ b/pkg/workflow/compiler_cache_test.go @@ -163,7 +163,7 @@ tools: } // Compile the workflow - compiler := NewCompilerWithVersion("v1.0.0") + compiler := NewCompiler(WithVersion("v1.0.0")) err := compiler.CompileWorkflow(testFile) if err != nil { t.Fatalf("Unexpected error compiling workflow: %v", err) diff --git a/pkg/workflow/compiler_custom_actions_test.go b/pkg/workflow/compiler_custom_actions_test.go index 28f3d4b5ce6..3531e1eb7cb 100644 --- a/pkg/workflow/compiler_custom_actions_test.go +++ b/pkg/workflow/compiler_custom_actions_test.go @@ -56,7 +56,7 @@ func TestActionModeString(t *testing.T) { // TestCompilerActionModeDefault tests that the compiler defaults to dev mode func TestCompilerActionModeDefault(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) if compiler.GetActionMode() != ActionModeDev { t.Errorf("Default action mode should be dev, got %s", compiler.GetActionMode()) } @@ -64,7 +64,7 @@ func TestCompilerActionModeDefault(t *testing.T) { // TestCompilerSetActionMode tests setting the action mode func TestCompilerSetActionMode(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) compiler.SetActionMode(ActionModeRelease) if compiler.GetActionMode() != ActionModeRelease { @@ -152,7 +152,7 @@ Test workflow with dev mode. } // Compile with dev mode (default) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) compiler.SetActionMode(ActionModeDev) compiler.SetNoEmit(false) @@ -209,7 +209,7 @@ Test workflow with script mode. } // Compile with script mode (will be overridden by feature flag) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) compiler.SetNoEmit(false) if err := compiler.CompileWorkflow(workflowPath); err != nil { @@ -347,7 +347,7 @@ func TestVersionToGitRef(t *testing.T) { // event-driven relays) can find the actions/ directory instead of defaulting to the // caller's repo which has no actions/ directory. func TestCheckoutActionsFolderDevModeHasRepository(t *testing.T) { - compiler := NewCompilerWithVersion("dev") + compiler := NewCompiler(WithVersion("dev")) compiler.SetActionMode(ActionModeDev) lines := compiler.generateCheckoutActionsFolder(nil) @@ -365,7 +365,7 @@ func TestCheckoutActionsFolderDevModeAlwaysEmitsCheckout(t *testing.T) { versions := []string{"dev", "e284d1e", "v0.57.2-60-ge284d1e", "v1.2.3"} for _, version := range versions { t.Run(version, func(t *testing.T) { - compiler := NewCompilerWithVersion(version) + compiler := NewCompiler(WithVersion(version)) compiler.SetActionMode(ActionModeDev) lines := compiler.generateCheckoutActionsFolder(nil) @@ -402,7 +402,7 @@ func TestResolveSetupActionReferenceActionModeDevVersion(t *testing.T) { // TestCheckoutActionsFolderActionModeNoCheckout verifies that action mode does not generate a checkout step func TestCheckoutActionsFolderActionModeNoCheckout(t *testing.T) { - compiler := NewCompilerWithVersion("v1.2.3") + compiler := NewCompiler(WithVersion("v1.2.3")) compiler.SetActionMode(ActionModeAction) lines := compiler.generateCheckoutActionsFolder(nil) @@ -431,7 +431,7 @@ Test workflow with action mode. t.Fatalf("Failed to write test workflow: %v", err) } - compiler := NewCompilerWithVersion("v1.2.3") + compiler := NewCompiler(WithVersion("v1.2.3")) compiler.SetActionMode(ActionModeAction) compiler.SetNoEmit(false) diff --git a/pkg/workflow/compiler_types.go b/pkg/workflow/compiler_types.go index c453082432d..3089b4bc6b0 100644 --- a/pkg/workflow/compiler_types.go +++ b/pkg/workflow/compiler_types.go @@ -42,6 +42,11 @@ func WithWorkflowIdentifier(identifier string) CompilerOption { return func(c *Compiler) { c.workflowIdentifier = identifier } } +// WithVersion sets the compiler version, used to determine action mode and version-specific behavior +func WithVersion(version string) CompilerOption { + return func(c *Compiler) { c.version = version } +} + // FileTracker interface for tracking files created during compilation type FileTracker interface { TrackCreated(filePath string) @@ -131,16 +136,6 @@ func NewCompiler(opts ...CompilerOption) *Compiler { return c } -// NewCompilerWithVersion creates a new workflow compiler with the legacy signature. -// Deprecated: Use NewCompiler with functional options instead. -// This function is kept for backward compatibility during migration. -func NewCompilerWithVersion(version string) *Compiler { - c := NewCompiler() - c.version = version - c.actionMode = DetectActionMode(c.version) - return c -} - // SetSkipValidation configures whether to skip schema validation func (c *Compiler) SetSkipValidation(skip bool) { c.skipValidation = skip diff --git a/pkg/workflow/compiler_validation_test.go b/pkg/workflow/compiler_validation_test.go index c42fc53ca84..7ca03978c26 100644 --- a/pkg/workflow/compiler_validation_test.go +++ b/pkg/workflow/compiler_validation_test.go @@ -229,7 +229,7 @@ This is a test workflow. } // Compile the workflow - compiler := NewCompilerWithVersion("v1.0.0") + compiler := NewCompiler(WithVersion("v1.0.0")) err := compiler.CompileWorkflow(testFile) if err != nil { t.Fatalf("Unexpected error compiling workflow: %v", err) diff --git a/pkg/workflow/compiler_yaml_error_wrapping_test.go b/pkg/workflow/compiler_yaml_error_wrapping_test.go index 18e78d4641a..fa0f2090a5f 100644 --- a/pkg/workflow/compiler_yaml_error_wrapping_test.go +++ b/pkg/workflow/compiler_yaml_error_wrapping_test.go @@ -59,7 +59,7 @@ jobs: require.NoError(t, err, "Failed to create test file") // Create compiler and try to compile - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err = compiler.CompileWorkflow(testFile) // Should return an error @@ -109,7 +109,7 @@ jobs: err := os.WriteFile(testFile, []byte(workflowContent), 0644) require.NoError(t, err) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err = compiler.CompileWorkflow(testFile) require.Error(t, err, "Expected error from invalid job dependency") @@ -182,7 +182,7 @@ jobs: err := os.WriteFile(testFile, []byte(tt.workflowContent), 0644) require.NoError(t, err) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err = compiler.CompileWorkflow(testFile) require.Error(t, err, "Expected error") diff --git a/pkg/workflow/dispatch_repository_test.go b/pkg/workflow/dispatch_repository_test.go index 1b77838511c..55891cc794c 100644 --- a/pkg/workflow/dispatch_repository_test.go +++ b/pkg/workflow/dispatch_repository_test.go @@ -14,7 +14,7 @@ import ( // TestParseDispatchRepositoryConfig_SingleTool tests parsing a single dispatch_repository tool func TestParseDispatchRepositoryConfig_SingleTool(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "dispatch_repository": map[string]any{ @@ -43,7 +43,7 @@ func TestParseDispatchRepositoryConfig_SingleTool(t *testing.T) { // TestParseDispatchRepositoryConfig_MultipleTools tests parsing multiple tools func TestParseDispatchRepositoryConfig_MultipleTools(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "dispatch_repository": map[string]any{ @@ -92,7 +92,7 @@ func TestParseDispatchRepositoryConfig_MultipleTools(t *testing.T) { // TestParseDispatchRepositoryConfig_DashAlias tests that "dispatch-repository" (dash) also works func TestParseDispatchRepositoryConfig_DashAlias(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "dispatch-repository": map[string]any{ @@ -111,7 +111,7 @@ func TestParseDispatchRepositoryConfig_DashAlias(t *testing.T) { // TestParseDispatchRepositoryConfig_Absent tests that nil is returned when key is absent func TestParseDispatchRepositoryConfig_Absent(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "create_issue": map[string]any{}, @@ -123,7 +123,7 @@ func TestParseDispatchRepositoryConfig_Absent(t *testing.T) { // TestParseDispatchRepositoryConfig_MaxCap tests that max is capped at 50 func TestParseDispatchRepositoryConfig_MaxCap(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) outputMap := map[string]any{ "dispatch_repository": map[string]any{ @@ -143,7 +143,7 @@ func TestParseDispatchRepositoryConfig_MaxCap(t *testing.T) { // TestValidateDispatchRepository_Valid tests that valid config passes validation func TestValidateDispatchRepository_Valid(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -174,7 +174,7 @@ func TestValidateDispatchRepository_Valid(t *testing.T) { // TestValidateDispatchRepository_MissingWorkflow tests error when workflow field is missing func TestValidateDispatchRepository_MissingWorkflow(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -206,7 +206,7 @@ func TestValidateDispatchRepository_MissingWorkflow(t *testing.T) { // TestValidateDispatchRepository_MissingEventType tests error when event_type field is missing func TestValidateDispatchRepository_MissingEventType(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -238,7 +238,7 @@ func TestValidateDispatchRepository_MissingEventType(t *testing.T) { // TestValidateDispatchRepository_MissingRepository tests error when no repository is specified func TestValidateDispatchRepository_MissingRepository(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -270,7 +270,7 @@ func TestValidateDispatchRepository_MissingRepository(t *testing.T) { // TestValidateDispatchRepository_AllowedRepositories tests valid config with allowed_repositories func TestValidateDispatchRepository_AllowedRepositories(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -301,7 +301,7 @@ func TestValidateDispatchRepository_AllowedRepositories(t *testing.T) { // TestValidateDispatchRepository_InvalidRepoFormat tests error for malformed repository slug func TestValidateDispatchRepository_InvalidRepoFormat(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -333,7 +333,7 @@ func TestValidateDispatchRepository_InvalidRepoFormat(t *testing.T) { // TestValidateDispatchRepository_GitHubExpression tests that GitHub Actions expressions are accepted func TestValidateDispatchRepository_GitHubExpression(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -364,7 +364,7 @@ func TestValidateDispatchRepository_GitHubExpression(t *testing.T) { // TestValidateDispatchRepository_EmptyTools tests error when no tools are defined func TestValidateDispatchRepository_EmptyTools(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowPath := filepath.Join(tmpDir, "dispatcher.md") @@ -386,7 +386,7 @@ func TestValidateDispatchRepository_EmptyTools(t *testing.T) { // TestValidateDispatchRepository_NilConfig tests that nil config is OK (no-op) func TestValidateDispatchRepository_NilConfig(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData := &WorkflowData{ SafeOutputs: &SafeOutputsConfig{ @@ -511,7 +511,7 @@ func TestDispatchRepositoryConfigSerialization(t *testing.T) { // TestDispatchRepositoryInWorkflowCompilation tests end-to-end compilation func TestDispatchRepositoryInWorkflowCompilation(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -564,7 +564,7 @@ This workflow dispatches repository events. // TestDispatchRepositoryValidation_InCompiler tests validation runs during compilation func TestDispatchRepositoryValidation_InCompiler(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") diff --git a/pkg/workflow/dispatch_workflow_test.go b/pkg/workflow/dispatch_workflow_test.go index 063d43cb223..cb889fbcde6 100644 --- a/pkg/workflow/dispatch_workflow_test.go +++ b/pkg/workflow/dispatch_workflow_test.go @@ -15,7 +15,7 @@ import ( // TestDispatchWorkflowMultiDirectoryDiscovery tests that dispatch_workflow can find workflows // in multiple directories (same directory and .github/workflows) func TestDispatchWorkflowMultiDirectoryDiscovery(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory structure tmpDir := t.TempDir() @@ -177,7 +177,7 @@ This workflow dispatches to test workflow. // TestDispatchWorkflowNotFound tests error handling when workflow is not found func TestDispatchWorkflowNotFound(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -230,7 +230,7 @@ This workflow tries to dispatch to a non-existent workflow. // TestDispatchWorkflowWithoutWorkflowDispatchTrigger tests error handling // when referenced workflow doesn't support workflow_dispatch func TestDispatchWorkflowWithoutWorkflowDispatchTrigger(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -297,7 +297,7 @@ This workflow tries to dispatch to ci workflow. // TestDispatchWorkflowFileExtensionResolution tests that the correct file extension // (.lock.yml or .yml) is stored in the WorkflowFiles map func TestDispatchWorkflowFileExtensionResolution(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -405,7 +405,7 @@ This workflow dispatches to different workflow types. // TestDispatchWorkflowValidationWithoutAgenticWorkflowsTool tests that dispatch-workflow // validation runs even when the agentic-workflows tool is not present func TestDispatchWorkflowValidationWithoutAgenticWorkflowsTool(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -461,7 +461,7 @@ No agentic-workflows tool is present. // TestDispatchWorkflowMultipleErrors tests that multiple validation errors are aggregated func TestDispatchWorkflowMultipleErrors(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) compiler.failFast = false // Enable error aggregation tmpDir := t.TempDir() @@ -539,7 +539,7 @@ This workflow has multiple validation errors. // TestDispatchWorkflowMultipleErrorsFailFast tests fail-fast mode stops at first error func TestDispatchWorkflowMultipleErrorsFailFast(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) compiler.failFast = true // Enable fail-fast mode tmpDir := t.TempDir() diff --git a/pkg/workflow/dispatch_workflow_validation_test.go b/pkg/workflow/dispatch_workflow_validation_test.go index adfaab291ac..ca130b1601b 100644 --- a/pkg/workflow/dispatch_workflow_validation_test.go +++ b/pkg/workflow/dispatch_workflow_validation_test.go @@ -16,7 +16,7 @@ import ( // Note: This test directly creates WorkflowData to bypass JSON schema validation // which also rejects empty arrays. The runtime validation provides a better error message. func TestDispatchWorkflowErrorMessage_EmptyList(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -56,7 +56,7 @@ func TestDispatchWorkflowErrorMessage_EmptyList(t *testing.T) { // TestDispatchWorkflowErrorMessage_NotFound tests that workflow not found // error message includes troubleshooting steps func TestDispatchWorkflowErrorMessage_NotFound(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -119,7 +119,7 @@ This workflow references a non-existent workflow. // TestDispatchWorkflowErrorMessage_SelfReference tests that self-reference // error message includes explanation and alternatives func TestDispatchWorkflowErrorMessage_SelfReference(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -180,7 +180,7 @@ This workflow tries to dispatch to itself. // (no .lock.yml) is accepted as a valid same-batch dispatch target when the .md has // workflow_dispatch in its 'on:' section. func TestDispatchWorkflowBatchAware_MDWithDispatch(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -247,7 +247,7 @@ This workflow dispatches to a same-batch target. // TestDispatchWorkflowBatchAware_MDWithoutDispatch tests that a workflow that only has a .md file // (no .lock.yml) and does NOT have workflow_dispatch in its 'on:' section fails validation. func TestDispatchWorkflowBatchAware_MDWithoutDispatch(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") @@ -313,7 +313,7 @@ safe-outputs: // TestDispatchWorkflowErrorMessage_MultipleErrors tests that multiple errors // with enhanced messages are aggregated correctly func TestDispatchWorkflowErrorMessage_MultipleErrors(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) compiler.failFast = false // Enable error aggregation tmpDir := t.TempDir() diff --git a/pkg/workflow/error_wrapping_test.go b/pkg/workflow/error_wrapping_test.go index acc499de15b..55434afb035 100644 --- a/pkg/workflow/error_wrapping_test.go +++ b/pkg/workflow/error_wrapping_test.go @@ -53,7 +53,7 @@ on: require.NoError(t, err, "Failed to write test file") // Try to compile the invalid workflow - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err = compiler.CompileWorkflow(testFile) return err }, @@ -66,7 +66,7 @@ on: name: "workflow file read error", operation: func() error { // Try to compile a non-existent file - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err := compiler.CompileWorkflow("/nonexistent/file.md") return err }, @@ -94,7 +94,7 @@ on: require.NoError(t, err, "Failed to write test file") // Try to compile with invalid import - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err = compiler.CompileWorkflow(testFile) return err }, @@ -158,7 +158,7 @@ func TestErrorMessagesPreserveContext(t *testing.T) { testFile := filepath.Join(tmpDir, "my-workflow.md") // Don't create the file - let it fail - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err := compiler.CompileWorkflow(testFile) return err }, @@ -177,7 +177,7 @@ on: 123456 err := os.WriteFile(testFile, []byte(content), 0644) require.NoError(t, err) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) err = compiler.CompileWorkflow(testFile) return err }, @@ -217,7 +217,7 @@ func TestStandardLibraryErrorsNotExposed(t *testing.T) { { name: "path errors from file operations", operation: func() error { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) return compiler.CompileWorkflow("/definitely/does/not/exist/workflow.md") }, notInChain: []any{ @@ -238,7 +238,7 @@ on: err := os.WriteFile(testFile, []byte(content), 0644) require.NoError(t, err) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) return compiler.CompileWorkflow(testFile) }, notInChain: []any{ diff --git a/pkg/workflow/firewall_args_integration_test.go b/pkg/workflow/firewall_args_integration_test.go index de898c73aec..ad2c6904730 100644 --- a/pkg/workflow/firewall_args_integration_test.go +++ b/pkg/workflow/firewall_args_integration_test.go @@ -45,7 +45,7 @@ Test workflow with custom AWF arguments. } // Compile the workflow - compiler := NewCompilerWithVersion("test-firewall-args") + compiler := NewCompiler(WithVersion("test-firewall-args")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { @@ -124,7 +124,7 @@ Test workflow without custom AWF arguments. } // Compile the workflow - compiler := NewCompilerWithVersion("test-no-custom-args") + compiler := NewCompiler(WithVersion("test-no-custom-args")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { @@ -199,7 +199,7 @@ Test workflow with SSL bump and allow-urls configuration. } // Compile the workflow - compiler := NewCompilerWithVersion("test-ssl-bump") + compiler := NewCompiler(WithVersion("test-ssl-bump")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { @@ -276,7 +276,7 @@ Workflow that uses the GitHub tool, requiring GITHUB_MCP_SERVER_TOKEN. t.Fatalf("Failed to write workflow file: %v", err) } - compiler := NewCompilerWithVersion("test-github-tool") + compiler := NewCompiler(WithVersion("test-github-tool")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { t.Fatalf("Failed to compile workflow: %v", err) @@ -326,7 +326,7 @@ Workflow pinning an AWF version that does not support --exclude-env. t.Fatalf("Failed to write workflow file: %v", err) } - compiler := NewCompilerWithVersion("test-old-awf-version") + compiler := NewCompiler(WithVersion("test-old-awf-version")) compiler.SetSkipValidation(true) if err := compiler.CompileWorkflow(workflowPath); err != nil { t.Fatalf("Failed to compile workflow: %v", err) diff --git a/pkg/workflow/firewall_workflow_test.go b/pkg/workflow/firewall_workflow_test.go index 541802e4cc9..e668f11786d 100644 --- a/pkg/workflow/firewall_workflow_test.go +++ b/pkg/workflow/firewall_workflow_test.go @@ -94,7 +94,7 @@ func TestFirewallWorkflowCompilation(t *testing.T) { } // Create compiler - c := NewCompilerWithVersion("firewall") + c := NewCompiler(WithVersion("firewall")) c.SetSkipValidation(true) // Extract and verify tools diff --git a/pkg/workflow/github_mcp_app_token_test.go b/pkg/workflow/github_mcp_app_token_test.go index 347b0ead7d5..55a0f5c562a 100644 --- a/pkg/workflow/github_mcp_app_token_test.go +++ b/pkg/workflow/github_mcp_app_token_test.go @@ -15,7 +15,7 @@ import ( // TestGitHubMCPAppTokenConfiguration tests that app configuration is correctly parsed for GitHub tool func TestGitHubMCPAppTokenConfiguration(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -59,7 +59,7 @@ Test workflow with GitHub MCP Server app configuration. // TestGitHubMCPAppTokenMintingStep tests that token minting step is generated func TestGitHubMCPAppTokenMintingStep(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -122,7 +122,7 @@ Test workflow with GitHub MCP app token minting. // TestGitHubMCPAppTokenAndGitHubTokenMutuallyExclusive tests that setting both app and github-token is rejected func TestGitHubMCPAppTokenAndGitHubTokenMutuallyExclusive(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -156,7 +156,7 @@ Test that setting both app and github-token is an error. // TestGitHubMCPAppTokenWithRemoteMode tests that app token works with remote mode func TestGitHubMCPAppTokenWithRemoteMode(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -212,7 +212,7 @@ Test app token with remote GitHub MCP Server. // TestGitHubMCPAppTokenOrgWide tests org-wide GitHub MCP token with wildcard func TestGitHubMCPAppTokenOrgWide(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -267,7 +267,7 @@ Test org-wide GitHub MCP app token. // Repo-scoping from a GitHub App token does not substitute for author-integrity filtering // inside a repository; public repos still need automatic min-integrity: approved protection. func TestGitHubMCPAppTokenWithLockdownDetectionStep(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -324,7 +324,7 @@ Test that determine-automatic-lockdown is generated even when app is configured. // (see https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app), // which maps to "permission-vulnerability-alerts" in actions/create-github-app-token. func TestGitHubMCPAppTokenWithDependabotToolset(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -398,7 +398,7 @@ Test that permission-vulnerability-alerts is emitted in the App token minting st // This allows org-level permissions (e.g. members: read) that are not valid GitHub // Actions scopes but are supported by GitHub Apps. func TestGitHubMCPAppTokenWithExtraPermissions(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -453,7 +453,7 @@ Test extra org-level permissions in GitHub App token. // under tools.github.github-app.permissions can suppress a GitHub App-only scope // that was set at job level by overriding it with 'none' (nested wins). func TestGitHubMCPAppTokenExtraPermissionsOverrideJobLevel(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -503,7 +503,7 @@ Test that nested permissions override job-level GitHub App-only scopes (nested w // rejects a workflow where tools.github.github-app.permissions contains a "write" // value, since write access is not allowed for GitHub App-only scopes in this section. func TestGitHubMCPAppTokenExtraPermissionsWriteRejected(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -589,7 +589,7 @@ Test workflow - top-level github-app checkout token must be minted in agent job. for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() testFile := filepath.Join(tmpDir, "test.md") err := os.WriteFile(testFile, []byte(tt.markdown), 0644) @@ -641,7 +641,7 @@ Test workflow - top-level github-app checkout token must be minted in agent job. // as job outputs (runner v2.308+). By minting within the agent job the token is // available as steps.github-mcp-app-token.outputs.token. func TestGitHubMCPAppTokenMintedInAgentJob(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues permissions: diff --git a/pkg/workflow/local_action_permissions_test.go b/pkg/workflow/local_action_permissions_test.go index a9028d5449f..d6e20f4b464 100644 --- a/pkg/workflow/local_action_permissions_test.go +++ b/pkg/workflow/local_action_permissions_test.go @@ -66,7 +66,7 @@ strict: false t.Fatal(err) } - compiler := NewCompilerWithVersion("dev") + compiler := NewCompiler(WithVersion("dev")) // Use dev mode to enable local action paths compiler.SetActionMode(ActionModeDev) @@ -162,7 +162,7 @@ command: /fix t.Fatal(err) } - compiler := NewCompilerWithVersion("v1.0.0") + compiler := NewCompiler(WithVersion("v1.0.0")) // Use release mode to test production behavior (no local action checkouts) compiler.SetActionMode(ActionModeRelease) diff --git a/pkg/workflow/permissions_explicit_empty_test.go b/pkg/workflow/permissions_explicit_empty_test.go index ff8ec183415..9cc69d8874c 100644 --- a/pkg/workflow/permissions_explicit_empty_test.go +++ b/pkg/workflow/permissions_explicit_empty_test.go @@ -90,7 +90,7 @@ Test content`, } // Compile with specified action mode - compiler := NewCompilerWithVersion("v1.0.0") + compiler := NewCompiler(WithVersion("v1.0.0")) compiler.actionMode = tt.actionMode err = compiler.CompileWorkflow(testFile) diff --git a/pkg/workflow/safe_jobs_threat_detection_test.go b/pkg/workflow/safe_jobs_threat_detection_test.go index 7abfbbcd69f..65ba1384b32 100644 --- a/pkg/workflow/safe_jobs_threat_detection_test.go +++ b/pkg/workflow/safe_jobs_threat_detection_test.go @@ -441,7 +441,7 @@ func TestIsThreatDetectionExplicitlyDisabledInConfigs(t *testing.T) { // threat detection is enabled by default — ensuring the detection gate is wired for // MCP-driven safe-output writes in native-card-style workflows. func TestDefaultThreatDetectionAppliedWhenSafeOutputsFromImportsOnly(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -502,7 +502,7 @@ This workflow uses safe-outputs via MCP tool calls (no explicit safe-outputs: fr // TestDefaultThreatDetectionNotAppliedWhenImportedConfigExplicitlyDisables verifies that // when an imported config explicitly sets threat-detection: false, the default is NOT applied. func TestDefaultThreatDetectionNotAppliedWhenImportedConfigExplicitlyDisables(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -561,7 +561,7 @@ imports: // for a native-card-style workflow (safe-outputs from imports only) contains a detection job // and that safe_outputs depends on both agent and detection. func TestImportedSafeOutputsCompiledWithDetectionJob(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := testutil.TempDir(t, "native-card-*") workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -637,7 +637,7 @@ Test that safe_outputs depends on detection when safe-outputs comes from imports // when an imported config disables detection via the object form (threat-detection: { enabled: false }), // the default is NOT applied — mirroring parseThreatDetectionConfig's object-form support. func TestDefaultThreatDetectionNotAppliedWhenImportedConfigObjectFormDisables(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") diff --git a/pkg/workflow/safe_outputs_allow_workflows_test.go b/pkg/workflow/safe_outputs_allow_workflows_test.go index 8f7ccf10a46..270bd813d8e 100644 --- a/pkg/workflow/safe_outputs_allow_workflows_test.go +++ b/pkg/workflow/safe_outputs_allow_workflows_test.go @@ -185,7 +185,7 @@ func TestAllowWorkflowsValidationRequiresGitHubApp(t *testing.T) { // TestAllowWorkflowsParsing tests that allow-workflows is correctly parsed from frontmatter. func TestAllowWorkflowsParsing(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -222,7 +222,7 @@ Test workflow with allow-workflows on create-pull-request. // TestAllowWorkflowsParsingPushToPullRequestBranch tests parsing for push-to-pull-request-branch. func TestAllowWorkflowsParsingPushToPullRequestBranch(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: pull_request @@ -259,7 +259,7 @@ Test workflow with allow-workflows on push-to-pull-request-branch. // TestAllowWorkflowsAppTokenPermission tests that when allow-workflows is true // and a GitHub App is configured, the compiled output includes permission-workflows: write. func TestAllowWorkflowsAppTokenPermission(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -300,7 +300,7 @@ Test workflow checking permission-workflows: write in GitHub App token. // TestAllowWorkflowsCompileErrorWithoutGitHubApp tests that compiling a workflow // with allow-workflows: true but no GitHub App produces a compile error. func TestAllowWorkflowsCompileErrorWithoutGitHubApp(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues diff --git a/pkg/workflow/safe_outputs_app_import_test.go b/pkg/workflow/safe_outputs_app_import_test.go index 307c74ac915..2c69e71ab99 100644 --- a/pkg/workflow/safe_outputs_app_import_test.go +++ b/pkg/workflow/safe_outputs_app_import_test.go @@ -13,7 +13,7 @@ import ( // TestSafeOutputsAppImport tests that app configuration can be imported from shared workflows func TestSafeOutputsAppImport(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -81,7 +81,7 @@ This workflow uses the imported app configuration. // TestSafeOutputsAppImportOverride tests that local app configuration overrides imported one func TestSafeOutputsAppImportOverride(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() diff --git a/pkg/workflow/safe_outputs_app_test.go b/pkg/workflow/safe_outputs_app_test.go index 3dc9cb4efaa..40279c10732 100644 --- a/pkg/workflow/safe_outputs_app_test.go +++ b/pkg/workflow/safe_outputs_app_test.go @@ -14,7 +14,7 @@ import ( // TestSafeOutputsAppConfiguration tests that app configuration is correctly parsed func TestSafeOutputsAppConfiguration(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -52,7 +52,7 @@ Test workflow with app configuration. // TestSafeOutputsAppConfigurationMinimal tests minimal app configuration without repositories func TestSafeOutputsAppConfigurationMinimal(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -87,7 +87,7 @@ Test workflow with minimal app configuration. // TestSafeOutputsAppWithoutSafeOutputs tests that app without safe outputs doesn't break func TestSafeOutputsAppWithoutSafeOutputs(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues @@ -118,7 +118,7 @@ Test workflow without safe outputs. // When any permission-* input is specified, the action scopes the token to ONLY those permissions, // so omitting permission-discussions would exclude discussions access from the minted token. func TestSafeOutputsAppTokenDiscussionsPermission(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) markdown := `--- on: issues diff --git a/pkg/workflow/safe_outputs_call_workflow_test.go b/pkg/workflow/safe_outputs_call_workflow_test.go index d97ed278f47..b66eb29345b 100644 --- a/pkg/workflow/safe_outputs_call_workflow_test.go +++ b/pkg/workflow/safe_outputs_call_workflow_test.go @@ -15,7 +15,7 @@ import ( // TestBuildCallWorkflowJobs_GeneratesConditionalJobs tests that call-workflow generates // conditional `uses:` jobs for each worker in the allowlist func TestBuildCallWorkflowJobs_GeneratesConditionalJobs(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData := &WorkflowData{ SafeOutputs: &SafeOutputsConfig{ @@ -51,7 +51,7 @@ func TestBuildCallWorkflowJobs_GeneratesConditionalJobs(t *testing.T) { // TestBuildCallWorkflowJobs_NoConfig returns nil when call-workflow is not configured func TestBuildCallWorkflowJobs_NoConfig(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData := &WorkflowData{ SafeOutputs: &SafeOutputsConfig{}, @@ -64,7 +64,7 @@ func TestBuildCallWorkflowJobs_NoConfig(t *testing.T) { // TestBuildCallWorkflowJobs_FallbackPath tests that missing WorkflowFiles falls back to default path func TestBuildCallWorkflowJobs_FallbackPath(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData := &WorkflowData{ SafeOutputs: &SafeOutputsConfig{ @@ -90,7 +90,7 @@ func TestBuildCallWorkflowJobs_FallbackPath(t *testing.T) { // TestSafeOutputsJobOutputs_CallWorkflow tests that safe_outputs job includes // call_workflow_name and call_workflow_payload outputs when call-workflow is configured func TestSafeOutputsJobOutputs_CallWorkflow(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -255,7 +255,7 @@ func TestGenerateCallWorkflowTool_EmptyInputs(t *testing.T) { // TestCallWorkflowJobYAMLOutput tests the YAML output of a call-workflow job func TestCallWorkflowJobYAMLOutput(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData := &WorkflowData{ SafeOutputs: &SafeOutputsConfig{ @@ -333,7 +333,7 @@ jobs: // TestCallWorkflowConclusionDependencies tests that conclusion job depends on call-workflow jobs func TestCallWorkflowConclusionDependencies(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -418,7 +418,7 @@ jobs: gatewayFile := filepath.Join(workflowsDir, "gateway.md") require.NoError(t, os.WriteFile(gatewayFile, []byte("# Gateway"), 0644)) - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData := &WorkflowData{ SafeOutputs: &SafeOutputsConfig{ CallWorkflow: &CallWorkflowConfig{ @@ -488,7 +488,7 @@ func TestExtractWorkflowCallInputsFromParsed(t *testing.T) { // TestCallWorkflowConfig_WithGeneratedYAML tests that the compiled YAML for a gateway workflow // includes the expected call-workflow fan-out jobs structure func TestCallWorkflowConfig_WithGeneratedYAML(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() awDir := filepath.Join(tmpDir, ".github", "aw") diff --git a/pkg/workflow/safe_outputs_default_max_test.go b/pkg/workflow/safe_outputs_default_max_test.go index c007a8ff46e..50a6cb93ca0 100644 --- a/pkg/workflow/safe_outputs_default_max_test.go +++ b/pkg/workflow/safe_outputs_default_max_test.go @@ -36,7 +36,7 @@ This workflow tests the default max for assign-to-agent. require.NoError(t, err, "Failed to write test workflow") // Parse the workflow - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData, err := compiler.ParseWorkflowFile(testFile) require.NoError(t, err, "Failed to parse workflow") @@ -88,7 +88,7 @@ This workflow tests the default max for dispatch-workflow. require.NoError(t, err, "Failed to write test workflow") // Parse the workflow - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData, err := compiler.ParseWorkflowFile(testFile) require.NoError(t, err, "Failed to parse workflow") @@ -123,7 +123,7 @@ This workflow tests explicit max for assign-to-agent. require.NoError(t, err, "Failed to write test workflow") // Parse the workflow - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData, err := compiler.ParseWorkflowFile(testFile) require.NoError(t, err, "Failed to parse workflow") @@ -177,7 +177,7 @@ This workflow tests explicit max for dispatch-workflow. require.NoError(t, err, "Failed to write test workflow") // Parse the workflow - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) workflowData, err := compiler.ParseWorkflowFile(testFile) require.NoError(t, err, "Failed to parse workflow") diff --git a/pkg/workflow/safe_outputs_fix_test.go b/pkg/workflow/safe_outputs_fix_test.go index cdc78451501..f17bf23917e 100644 --- a/pkg/workflow/safe_outputs_fix_test.go +++ b/pkg/workflow/safe_outputs_fix_test.go @@ -141,7 +141,7 @@ func TestSafeOutputsConfigYAMLTags(t *testing.T) { // (Footer, AllowGitHubReferences, GroupReports, MaxBotMentions, Mentions) are correctly // merged from imported workflow configs when absent in the top-level config. func TestMergeSafeOutputsMetaFieldsUnit(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tests := []struct { name string @@ -260,7 +260,7 @@ func TestMergeSafeOutputsMetaFieldsUnit(t *testing.T) { // TestMergeProtectedFilesExcludeAsSet verifies that when both the top-level and imported // configs define the same handler, their protected-files exclude lists are merged as a set. func TestMergeProtectedFilesExcludeAsSet(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tests := []struct { name string diff --git a/pkg/workflow/safe_outputs_import_test.go b/pkg/workflow/safe_outputs_import_test.go index b9d6f89f344..74e333a80df 100644 --- a/pkg/workflow/safe_outputs_import_test.go +++ b/pkg/workflow/safe_outputs_import_test.go @@ -13,7 +13,7 @@ import ( // TestSafeOutputsImport tests that safe-output types can be imported from shared workflows func TestSafeOutputsImport(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -78,7 +78,7 @@ This workflow uses the imported create-issue configuration. // TestSafeOutputsImportMultipleTypes tests importing multiple safe-output types from a shared workflow func TestSafeOutputsImportMultipleTypes(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -145,7 +145,7 @@ imports: // TestSafeOutputsImportOverride tests that when the same safe-output type is defined in both main and imported workflow, the main workflow's definition takes precedence func TestSafeOutputsImportOverride(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -205,7 +205,7 @@ safe-outputs: // TestSafeOutputsImportConflictBetweenImports tests that a conflict error is returned when the same safe-output type is defined in multiple imported workflows func TestSafeOutputsImportConflictBetweenImports(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -274,7 +274,7 @@ imports: // TestSafeOutputsImportNoConflictDifferentTypes tests that importing different safe-output types does not cause a conflict func TestSafeOutputsImportNoConflictDifferentTypes(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -339,7 +339,7 @@ safe-outputs: // TestSafeOutputsImportFromMultipleWorkflows tests importing different safe-output types from multiple workflows func TestSafeOutputsImportFromMultipleWorkflows(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -414,7 +414,7 @@ imports: // TestMergeSafeOutputsUnit tests the MergeSafeOutputs function directly func TestMergeSafeOutputsUnit(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tests := []struct { name string @@ -505,7 +505,7 @@ func TestMergeSafeOutputsUnit(t *testing.T) { // TestMergeSafeOutputsMessagesUnit tests the MergeSafeOutputs function for messages field func TestMergeSafeOutputsMessagesUnit(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tests := []struct { name string @@ -621,7 +621,7 @@ func TestMergeSafeOutputsMessagesUnit(t *testing.T) { // TestSafeOutputsImportMetaFields tests that safe-output meta fields can be imported from shared workflows func TestSafeOutputsImportMetaFields(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -702,7 +702,7 @@ This workflow uses the imported meta configuration. // TestSafeOutputsImportMetaFieldsMainTakesPrecedence tests that main workflow meta fields take precedence over imports func TestSafeOutputsImportMetaFieldsMainTakesPrecedence(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -771,7 +771,7 @@ This workflow has its own meta configuration that should take precedence. // TestSafeOutputsImportMetaFieldsFromOnlyImport tests that meta fields are correctly imported when main has no safe-outputs section func TestSafeOutputsImportMetaFieldsFromOnlyImport(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -843,7 +843,7 @@ This workflow uses only imported safe-outputs configuration. // TestSafeOutputsImportJobsFromSharedWorkflow tests that safe-outputs.jobs can be imported from shared workflows func TestSafeOutputsImportJobsFromSharedWorkflow(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -920,7 +920,7 @@ This workflow imports safe-jobs from a shared workflow. // TestSafeOutputsImportJobsWithMainWorkflowJobs tests importing jobs when main workflow also has jobs func TestSafeOutputsImportJobsWithMainWorkflowJobs(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1000,7 +1000,7 @@ This workflow has its own jobs and imports more jobs. // TestSafeOutputsImportJobsConflict tests that a conflict error is returned when the same job name is defined in both main and imported workflow func TestSafeOutputsImportJobsConflict(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1067,7 +1067,7 @@ safe-outputs: // TestSafeOutputsImportMessagesFromSharedWorkflow tests that safe-outputs.messages can be imported from shared workflows func TestSafeOutputsImportMessagesFromSharedWorkflow(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1143,7 +1143,7 @@ This workflow imports messages from a shared workflow. // TestSafeOutputsImportMessagesMainOverrides tests that main workflow messages take precedence over imports func TestSafeOutputsImportMessagesMainOverrides(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1224,7 +1224,7 @@ Main workflow defines some messages that should take precedence. // TestSafeOutputsImportMessagesWithNoMainSafeOutputs tests messages import when main has no safe-outputs section func TestSafeOutputsImportMessagesWithNoMainSafeOutputs(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1292,7 +1292,7 @@ Uses only imported safe-outputs including messages. // TestMergeSafeOutputsJobsNotMerged tests that Jobs are NOT merged in MergeSafeOutputs // because they are handled separately in the orchestrator via mergeSafeJobsFromIncludedConfigs func TestMergeSafeOutputsJobsNotMerged(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a top-level config with a job topConfig := &SafeOutputsConfig{ @@ -1324,7 +1324,7 @@ func TestMergeSafeOutputsJobsNotMerged(t *testing.T) { // TestMergeSafeOutputsJobsSkippedWhenEmpty tests that Jobs field is not created if not present func TestMergeSafeOutputsJobsSkippedWhenEmpty(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a top-level config without jobs topConfig := &SafeOutputsConfig{ @@ -1351,7 +1351,7 @@ func TestMergeSafeOutputsJobsSkippedWhenEmpty(t *testing.T) { // TestMergeSafeOutputsErrorPropagation tests error propagation from mergeSafeOutputConfig // This test verifies the error handling infrastructure is in place func TestMergeSafeOutputsErrorPropagation(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tests := []struct { name string @@ -1406,7 +1406,7 @@ func TestMergeSafeOutputsErrorPropagation(t *testing.T) { // This verifies that Jobs ARE properly imported when going through ParseWorkflowFile // (which uses the orchestrator's mergeSafeJobsFromIncludedConfigs) func TestMergeSafeOutputsWithJobsIntegration(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1485,7 +1485,7 @@ This workflow imports jobs and safe-outputs. // TestProjectSafeOutputsImport tests that project-related safe-output types can be imported from shared workflows // This specifically tests the fix for the bug where CreateProjectStatusUpdates was not being merged from imports func TestProjectSafeOutputsImport(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1566,7 +1566,7 @@ This workflow uses the imported project safe-output configuration. // TestAllMissingSafeOutputTypesImport tests that all previously missing safe-output types can be imported // This test ensures that all types in SafeOutputsConfig are properly merged from imports func TestAllMissingSafeOutputTypesImport(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1662,7 +1662,7 @@ This workflow uses the imported safe-output configuration for previously missing // TestSafeOutputsImportMessagesAllFields tests that all message fields can be imported correctly func TestSafeOutputsImportMessagesAllFields(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1740,7 +1740,7 @@ safe-outputs: // TestSafeOutputsImportMessagesAllFieldsPartialOverride tests that main workflow can selectively override imported message fields func TestSafeOutputsImportMessagesAllFieldsPartialOverride(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory for test files tmpDir := t.TempDir() @@ -1828,7 +1828,7 @@ safe-outputs: // explicitly disables threat-detection, imported fragments with no threat-detection key do not // re-enable it. func TestMergeSafeOutputsThreatDetectionExplicitDisableNotOverridden(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Simulate main workflow that explicitly disabled threat-detection: // threat-detection: false → parseThreatDetectionConfig returns nil. @@ -1853,7 +1853,7 @@ func TestMergeSafeOutputsThreatDetectionExplicitDisableNotOverridden(t *testing. // TestMergeSafeOutputsThreatDetectionImportedWhenExplicit tests that an import that explicitly // carries a threat-detection key can set it when the main workflow has not configured it. func TestMergeSafeOutputsThreatDetectionImportedWhenExplicit(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Import fragment that explicitly enables threat-detection. importedJSON := []string{ @@ -1872,7 +1872,7 @@ func TestMergeSafeOutputsThreatDetectionImportedWhenExplicit(t *testing.T) { // the bug where an imported fragment re-enables threat-detection that was explicitly disabled // in the main workflow. This caused a compilation error when sandbox.agent was also false. func TestSafeOutputsImportDoesNotReenableThreatDetection(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -1937,7 +1937,7 @@ safe-outputs: // safe-outputs were present) caused threat-detection to appear as "already defined" in // topDefinedTypes, so the import's explicit threat-detection configuration was dropped. func TestSafeOutputsDifferentTypesFromImportsMerged(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -2000,7 +2000,7 @@ Print "hello world!". // Previously, extractSafeOutputsConfig created auto-defaults for these types that // would silently block import merges. func TestSafeOutputsAutoDefaultableTypesImportedWhenMainHasNone(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -2082,7 +2082,7 @@ Run a task. // workflow explicitly configures an auto-defaultable type (e.g. noop), an import that also // defines the same type is overridden by the main (main wins / override semantics). func TestSafeOutputsMainExplicitAutoDefaultableTypeOverridesImport(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -2143,7 +2143,7 @@ Run a task. // several imports each contribute a different auto-defaultable type, all of them are // merged and none triggers a conflict error. func TestSafeOutputsMultipleImportsEachContributeAutoDefaultableType(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") diff --git a/pkg/workflow/top_level_github_app_import_test.go b/pkg/workflow/top_level_github_app_import_test.go index ed28d91147c..15e54969752 100644 --- a/pkg/workflow/top_level_github_app_import_test.go +++ b/pkg/workflow/top_level_github_app_import_test.go @@ -14,7 +14,7 @@ import ( // TestTopLevelGitHubAppImport tests that a top-level github-app can be imported // from a shared agent workflow and propagated as a fallback for all nested operations. func TestTopLevelGitHubAppImport(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Create a temporary directory simulating .github/workflows layout tmpDir := t.TempDir() @@ -81,7 +81,7 @@ This workflow imports the top-level github-app from the shared workflow. // TestTopLevelGitHubAppImportOverride tests that the current workflow's own top-level // github-app takes precedence over one imported from a shared workflow. func TestTopLevelGitHubAppImportOverride(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -140,7 +140,7 @@ This workflow's own top-level github-app takes precedence over the imported one. // TestTopLevelGitHubAppToolsGitHubTokenSkip tests that the fallback is NOT applied // to tools.github when a custom github-token is already configured for the MCP server. func TestTopLevelGitHubAppToolsGitHubTokenSkip(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) // Use ParseWorkflowFile directly with inline frontmatter tmpDir := t.TempDir() @@ -193,7 +193,7 @@ When tools.github.github-token is set, the top-level github-app fallback should // TestTopLevelGitHubAppToolsGitHubFalseSkip tests that the fallback is NOT applied // to tools.github when github is explicitly disabled (github: false). func TestTopLevelGitHubAppToolsGitHubFalseSkip(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -238,7 +238,7 @@ When tools.github is set to false, the top-level github-app fallback should NOT // workflow is propagated to the activation job (reactions/status comments). func TestTopLevelGitHubAppImportActivation(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -293,7 +293,7 @@ safe-outputs: // TestTopLevelGitHubAppActivationOverride tests that an explicit on.github-app configuration // takes precedence over the top-level github-app fallback. func TestTopLevelGitHubAppActivationOverride(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -347,7 +347,7 @@ When on.github-app is explicitly set, it takes precedence over the top-level git // at runtime app tokens take precedence over tokens and injecting the fallback would flip // the user's intended auth precedence. func TestTopLevelGitHubAppActivationTokenSkip(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -394,7 +394,7 @@ When on.github-token is set, the top-level github-app must NOT be applied to act // TestTopLevelGitHubAppSafeOutputsFallback tests that the top-level github-app is applied // to safe-outputs when no section-specific github-app is configured. func TestTopLevelGitHubAppSafeOutputsFallback(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -435,7 +435,7 @@ engine: copilot // TestTopLevelGitHubAppSafeOutputsOverride tests that a section-specific safe-outputs.github-app // takes precedence over the top-level github-app fallback. func TestTopLevelGitHubAppSafeOutputsOverride(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -478,7 +478,7 @@ engine: copilot // TestTopLevelGitHubAppSafeOutputsTokenSkip tests that the top-level github-app fallback // is NOT applied to safe-outputs when safe-outputs.github-token is explicitly set. func TestTopLevelGitHubAppSafeOutputsTokenSkip(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -520,7 +520,7 @@ engine: copilot // TestTopLevelGitHubAppCheckoutFallback tests that the top-level github-app is applied // to a checkout entry that has no explicit auth (no github-app, no github-token). func TestTopLevelGitHubAppCheckoutFallback(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -564,7 +564,7 @@ engine: copilot // TestTopLevelGitHubAppCheckoutOverride tests that a section-specific checkout.github-app // takes precedence over the top-level github-app fallback. func TestTopLevelGitHubAppCheckoutOverride(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -610,7 +610,7 @@ engine: copilot // TestTopLevelGitHubAppCheckoutTokenSkip tests that the top-level github-app fallback is NOT // applied to a checkout entry that has an explicit github-token set. func TestTopLevelGitHubAppCheckoutTokenSkip(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -655,7 +655,7 @@ engine: copilot // TestTopLevelGitHubAppToolsFallback tests that the top-level github-app is applied // to tools.github when no section-specific auth is configured. func TestTopLevelGitHubAppToolsFallback(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows") @@ -701,7 +701,7 @@ engine: copilot // TestTopLevelGitHubAppToolsOverride tests that a section-specific tools.github.github-app // takes precedence over the top-level github-app fallback. func TestTopLevelGitHubAppToolsOverride(t *testing.T) { - compiler := NewCompilerWithVersion("1.0.0") + compiler := NewCompiler(WithVersion("1.0.0")) tmpDir := t.TempDir() workflowsDir := filepath.Join(tmpDir, ".github", "workflows")