Skip to content

Commit 256ca3e

Browse files
CopilotEMaher
andcommitted
chore: validate log-level input handling in integration workflow
Agent-Logs-Url: https://github.com/Azure/apiops-cli/sessions/08964b6c-4c8a-4dda-bcb9-17322e0e16bb Co-authored-by: EMaher <9244742+EMaher@users.noreply.github.com>
1 parent ea3cefe commit 256ca3e

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/integration-test.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,9 @@ on:
4242
type: string
4343
default: 'centralus'
4444
log_level:
45-
description: 'PowerShell log level'
45+
description: 'PowerShell log level (Info, Verbose, Debug)'
4646
required: false
47-
type: choice
48-
options:
49-
- Info
50-
- Verbose
51-
- Debug
47+
type: string
5248
default: Verbose
5349
skip_teardown:
5450
description: 'Skip teardown (for debugging)'
@@ -69,7 +65,7 @@ on:
6965
type: string
7066
default: 'centralus'
7167
log_level:
72-
description: 'PowerShell log level'
68+
description: 'PowerShell log level (Info, Verbose, Debug)'
7369
required: false
7470
type: string
7571
default: Verbose
@@ -128,12 +124,18 @@ jobs:
128124
shell: pwsh
129125
run: |
130126
$skipTeardown = '${{ inputs.skip_teardown }}' -eq 'true'
127+
$logLevel = '${{ inputs.log_level }}'
128+
if ([string]::IsNullOrWhiteSpace($logLevel)) { $logLevel = 'Verbose' }
129+
if ($logLevel -notin @('Info', 'Verbose', 'Debug')) {
130+
throw "Invalid log_level '$logLevel'. Allowed values: Info, Verbose, Debug."
131+
}
132+
131133
$params = @{
132134
SourceResourceGroup = '${{ env.SOURCE_RG }}'
133135
TargetResourceGroup = '${{ env.TARGET_RG }}'
134136
SkuName = '${{ inputs.sku }}'
135137
Location = '${{ inputs.location }}'
136-
LogLevel = '${{ inputs.log_level }}'
138+
LogLevel = $logLevel
137139
PublisherEmail = '${{ secrets.APIM_PUBLISHER_EMAIL }}'
138140
ExtractOutputDir = './extracted-artifacts'
139141
HardDelete = $true

0 commit comments

Comments
 (0)