Skip to content

Commit 78b146b

Browse files
Address code review feedback: extract ANSI regex pattern and clarify demonstration code
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
1 parent 666490f commit 78b146b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/workflows/TestWorkflow.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,16 +387,18 @@ jobs:
387387
}
388388
389389
LogGroup 'Test output access patterns' {
390-
# Verify the patterns shown in help text work
390+
# Demonstrate the patterns shown in help text work correctly
391+
# These patterns are used above in the env section
391392
$directPattern = @'
392393
${{ fromJson(steps.direct-test.outputs.result).DirectOutput }}
393394
'@
394395
$compositePattern = @'
395396
${{ fromJson(steps.composite-test.outputs.result).TestOutput1 }}
396397
'@
397-
Write-Host "Direct pattern used: $directPattern"
398-
Write-Host "Composite pattern used: $compositePattern"
398+
Write-Host "Direct access pattern: $directPattern"
399+
Write-Host "Composite access pattern: $compositePattern"
399400
Write-Host "✅ Both access patterns work correctly"
401+
Write-Host "✅ Values retrieved successfully prove patterns work"
400402
}
401403
402404
# Test 4: Validate output help text format

tests/validate-output-help-text.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ param()
1717

1818
$ErrorActionPreference = 'Stop'
1919

20+
# Regex pattern to remove ANSI color codes for validation
21+
$script:AnsiEscapePattern = '\x1b\[[0-9;]*m'
22+
2023
function Test-OutputHelpText {
2124
param(
2225
[string]$StepId,
@@ -42,8 +45,8 @@ function Test-OutputHelpText {
4245
Write-Host $nestedUsage
4346

4447
# Remove ANSI codes for validation
45-
$directUsageClean = $directUsage -replace '\x1b\[[0-9;]*m', ''
46-
$nestedUsageClean = $nestedUsage -replace '\x1b\[[0-9;]*m', ''
48+
$directUsageClean = $directUsage -replace $script:AnsiEscapePattern, ''
49+
$nestedUsageClean = $nestedUsage -replace $script:AnsiEscapePattern, ''
4750

4851
# Validate the format
4952
$expectedDirectPattern = "\$\{\{ fromJson\(steps\.$StepId\.outputs\.result\)\.$OutputName \}\}"
@@ -86,7 +89,7 @@ function Test-OutputHelpText {
8689
Write-Host $genericUsage
8790

8891
# Remove ANSI codes for validation
89-
$genericUsageClean = $genericUsage -replace '\x1b\[[0-9;]*m', ''
92+
$genericUsageClean = $genericUsage -replace $script:AnsiEscapePattern, ''
9093

9194
$expectedGenericPattern = "\$\{\{ fromJson\(steps\.<step-id>\.outputs\.result\)\.$OutputName \}\}"
9295

0 commit comments

Comments
 (0)