diff --git a/pkg/workflow/dispatch_repository.go b/pkg/workflow/dispatch_repository.go index 05bcdd558e2..23aac285a83 100644 --- a/pkg/workflow/dispatch_repository.go +++ b/pkg/workflow/dispatch_repository.go @@ -27,18 +27,12 @@ type DispatchRepositoryConfig struct { } // parseDispatchRepositoryConfig parses dispatch_repository configuration from the safe-outputs map. -// Accepts both "dispatch_repository" (underscore, preferred) and "dispatch-repository" (dash, alias). func (c *Compiler) parseDispatchRepositoryConfig(outputMap map[string]any) *DispatchRepositoryConfig { dispatchRepositoryLog.Print("Parsing dispatch_repository configuration") - var configData any - var exists bool - - // Support both underscore and dash variants - if configData, exists = outputMap["dispatch_repository"]; !exists { - if configData, exists = outputMap["dispatch-repository"]; !exists { - return nil - } + configData, exists := outputMap["dispatch_repository"] + if !exists { + return nil } configMap, ok := configData.(map[string]any) diff --git a/pkg/workflow/dispatch_repository_test.go b/pkg/workflow/dispatch_repository_test.go index 299cb7ab4a7..1e17494cc04 100644 --- a/pkg/workflow/dispatch_repository_test.go +++ b/pkg/workflow/dispatch_repository_test.go @@ -90,25 +90,6 @@ func TestParseDispatchRepositoryConfig_MultipleTools(t *testing.T) { assert.Equal(t, strPtr("2"), notifyService.Max) } -// TestParseDispatchRepositoryConfig_DashAlias tests that "dispatch-repository" (dash) also works -func TestParseDispatchRepositoryConfig_DashAlias(t *testing.T) { - compiler := NewCompiler(WithVersion("1.0.0")) - - outputMap := map[string]any{ - "dispatch-repository": map[string]any{ - "trigger_ci": map[string]any{ - "workflow": "ci.yml", - "event_type": "ci_trigger", - "repository": "org/target-repo", - }, - }, - } - - config := compiler.parseDispatchRepositoryConfig(outputMap) - require.NotNil(t, config, "Config should be parsed from dash form") - require.Len(t, config.Tools, 1, "Should have 1 tool") -} - // TestParseDispatchRepositoryConfig_Absent tests that nil is returned when key is absent func TestParseDispatchRepositoryConfig_Absent(t *testing.T) { compiler := NewCompiler(WithVersion("1.0.0"))