diff --git a/.github/workflows/codegen-validation.yml b/.github/workflows/codegen-validation.yml index f897d3a9c..3626c0a9d 100644 --- a/.github/workflows/codegen-validation.yml +++ b/.github/workflows/codegen-validation.yml @@ -35,7 +35,7 @@ jobs: shell: pwsh run: | Write-Host "Running code generation validation..." - ./scripts/Invoke-CodeGen.ps1 + ./scripts/Invoke-CodeGen.ps1 -Clean if ($LASTEXITCODE -ne 0) { Write-Error "Code generation failed with exit code: $LASTEXITCODE" diff --git a/scripts/Invoke-CodeGen.ps1 b/scripts/Invoke-CodeGen.ps1 index 51204d17f..20f84eb12 100644 --- a/scripts/Invoke-CodeGen.ps1 +++ b/scripts/Invoke-CodeGen.ps1 @@ -16,7 +16,10 @@ param( [string]$LocalRepositoryPath, [Parameter(Mandatory = $false)] - [switch]$Force + [switch]$Force, + + [Parameter(Mandatory = $false)] + [switch]$Clean ) function Invoke-ScriptWithLogging { @@ -293,6 +296,14 @@ try { Write-ElapsedTime "npm ci complete" + if ($Clean) { + Invoke-ScriptWithLogging { npm run clean -w $codegenFolderPath } + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } + Write-ElapsedTime "npm run clean complete" + } + Invoke-ScriptWithLogging { npm run build -w $codegenFolderPath } if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE