@@ -115,6 +115,91 @@ This workflow has no output configuration.
115115 }
116116}
117117
118+ func TestOutputConfigNull (t * testing.T ) {
119+ // Create temporary directory for test files
120+ tmpDir , err := os .MkdirTemp ("" , "output-config-null-test" )
121+ if err != nil {
122+ t .Fatal (err )
123+ }
124+ defer os .RemoveAll (tmpDir )
125+
126+ // Test case with null values for create-issue and create-pull-request
127+ testContent := `---
128+ on: push
129+ permissions:
130+ contents: read
131+ issues: write
132+ pull-requests: write
133+ engine: claude
134+ safe-outputs:
135+ create-issue:
136+ create-pull-request:
137+ add-issue-comment:
138+ add-issue-labels:
139+ ---
140+
141+ # Test Null Output Configuration
142+
143+ This workflow tests the null output configuration parsing.
144+ `
145+
146+ testFile := filepath .Join (tmpDir , "test-null-output-config.md" )
147+ if err := os .WriteFile (testFile , []byte (testContent ), 0644 ); err != nil {
148+ t .Fatal (err )
149+ }
150+
151+ compiler := NewCompiler (false , "" , "test" )
152+
153+ // Parse the workflow data
154+ workflowData , err := compiler .parseWorkflowFile (testFile )
155+ if err != nil {
156+ t .Fatalf ("Unexpected error parsing workflow with null output config: %v" , err )
157+ }
158+
159+ // Verify output configuration is parsed correctly
160+ if workflowData .SafeOutputs == nil {
161+ t .Fatal ("Expected output configuration to be parsed" )
162+ }
163+
164+ // Verify create-issue configuration is parsed with empty values
165+ if workflowData .SafeOutputs .CreateIssue == nil {
166+ t .Fatal ("Expected create-issue configuration to be parsed with null value" )
167+ }
168+ if workflowData .SafeOutputs .CreateIssue .TitlePrefix != "" {
169+ t .Errorf ("Expected empty title prefix for null create-issue, got '%s'" , workflowData .SafeOutputs .CreateIssue .TitlePrefix )
170+ }
171+ if len (workflowData .SafeOutputs .CreateIssue .Labels ) != 0 {
172+ t .Errorf ("Expected empty labels for null create-issue, got %v" , workflowData .SafeOutputs .CreateIssue .Labels )
173+ }
174+
175+ // Verify create-pull-request configuration is parsed with empty values
176+ if workflowData .SafeOutputs .CreatePullRequest == nil {
177+ t .Fatal ("Expected create-pull-request configuration to be parsed with null value" )
178+ }
179+ if workflowData .SafeOutputs .CreatePullRequest .TitlePrefix != "" {
180+ t .Errorf ("Expected empty title prefix for null create-pull-request, got '%s'" , workflowData .SafeOutputs .CreatePullRequest .TitlePrefix )
181+ }
182+ if len (workflowData .SafeOutputs .CreatePullRequest .Labels ) != 0 {
183+ t .Errorf ("Expected empty labels for null create-pull-request, got %v" , workflowData .SafeOutputs .CreatePullRequest .Labels )
184+ }
185+
186+ // Verify add-issue-comment configuration is parsed with empty values
187+ if workflowData .SafeOutputs .AddIssueComment == nil {
188+ t .Fatal ("Expected add-issue-comment configuration to be parsed with null value" )
189+ }
190+
191+ // Verify add-issue-labels configuration is parsed with empty values
192+ if workflowData .SafeOutputs .AddIssueLabels == nil {
193+ t .Fatal ("Expected add-issue-labels configuration to be parsed with null value" )
194+ }
195+ if len (workflowData .SafeOutputs .AddIssueLabels .Allowed ) != 0 {
196+ t .Errorf ("Expected empty allowed labels for null add-issue-labels, got %v" , workflowData .SafeOutputs .AddIssueLabels .Allowed )
197+ }
198+ if workflowData .SafeOutputs .AddIssueLabels .MaxCount != nil {
199+ t .Errorf ("Expected nil MaxCount for null add-issue-labels, got %v" , * workflowData .SafeOutputs .AddIssueLabels .MaxCount )
200+ }
201+ }
202+
118203func TestOutputIssueJobGeneration (t * testing.T ) {
119204 // Create temporary directory for test files
120205 tmpDir , err := os .MkdirTemp ("" , "output-issue-job-test" )
0 commit comments