@@ -319,6 +319,86 @@ jobs:
319319 }
320320 }
321321
322+ ActionTestCompositeOutputs :
323+ name : Composite Action Outputs Test
324+ runs-on : ${{ inputs.runs-on }}
325+ steps :
326+ # Need to check out as part of the test, as its a local action
327+ - name : Checkout repo
328+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
329+ with :
330+ persist-credentials : false
331+
332+ # Test 1: Direct usage of GitHub-Script action
333+ - name : Direct GitHub-Script Usage
334+ id : direct-test
335+ uses : ./
336+ with :
337+ Name : Direct-Usage-Test
338+ Prerelease : ${{ inputs.Prerelease }}
339+ ShowOutput : true
340+ Script : |
341+ Set-GitHubOutput -Name 'DirectOutput' -Value 'This is from direct usage'
342+
343+ # Test 2: Nested usage via composite action
344+ - name : Composite Action Usage
345+ id : composite-test
346+ uses : ./.github/actions/test-composite
347+ with :
348+ Prerelease : ${{ inputs.Prerelease }}
349+
350+ # Test 3: Verify outputs work correctly
351+ - name : Verify Outputs
352+ shell : pwsh
353+ env :
354+ DIRECT_OUTPUT : >-
355+ ${{ fromJson(steps.direct-test.outputs.result).DirectOutput }}
356+ COMPOSITE_OUTPUT1 : >-
357+ ${{ fromJson(steps.composite-test.outputs.result).TestOutput1 }}
358+ COMPOSITE_OUTPUT2 : >-
359+ ${{ fromJson(steps.composite-test.outputs.result).TestOutput2 }}
360+ COMPOSITE_MESSAGE : >-
361+ ${{ fromJson(steps.composite-test.outputs.result).CompositeMessage
362+ }}
363+ run : |
364+ $PSStyle.OutputRendering = 'Ansi'
365+
366+ LogGroup 'Verify Direct Output' {
367+ Write-Host "Direct Output: $env:DIRECT_OUTPUT"
368+ if ($env:DIRECT_OUTPUT -ne 'This is from direct usage') {
369+ throw "Direct output verification failed"
370+ }
371+ Write-Host "✅ Direct output is correct"
372+ }
373+
374+ LogGroup 'Verify Composite Outputs' {
375+ Write-Host "Composite Output 1: $env:COMPOSITE_OUTPUT1"
376+ Write-Host "Composite Output 2: $env:COMPOSITE_OUTPUT2"
377+ Write-Host "Composite Message: $env:COMPOSITE_MESSAGE"
378+
379+ if ($env:COMPOSITE_OUTPUT1 -ne 'Value from composite action') {
380+ throw "Composite output 1 verification failed"
381+ }
382+ $expectedMsg = 'This output is from a nested composite action'
383+ if ($env:COMPOSITE_MESSAGE -ne $expectedMsg) {
384+ throw "Composite message verification failed"
385+ }
386+ Write-Host "✅ Composite outputs are correct"
387+ }
388+
389+ LogGroup 'Test output access patterns' {
390+ # Verify the patterns shown in help text work
391+ $directPattern = @'
392+ ${{ fromJson(steps.direct-test.outputs.result).DirectOutput }}
393+ '@
394+ $compositePattern = @'
395+ ${{ fromJson(steps.composite-test.outputs.result).TestOutput1 }}
396+ '@
397+ Write-Host "Direct pattern used: $directPattern"
398+ Write-Host "Composite pattern used: $compositePattern"
399+ Write-Host "✅ Both access patterns work correctly"
400+ }
401+
322402 MatrixCreator :
323403 name : Matrix Creator
324404 runs-on : ubuntu-latest
0 commit comments