Skip to content

Commit 84fb83b

Browse files
build: add clean option for codegen script (#775)
1 parent bfebede commit 84fb83b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/workflows/codegen-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
shell: pwsh
3737
run: |
3838
Write-Host "Running code generation validation..."
39-
./scripts/Invoke-CodeGen.ps1
39+
./scripts/Invoke-CodeGen.ps1 -Clean
4040
4141
if ($LASTEXITCODE -ne 0) {
4242
Write-Error "Code generation failed with exit code: $LASTEXITCODE"

scripts/Invoke-CodeGen.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ param(
1616
[string]$LocalRepositoryPath,
1717

1818
[Parameter(Mandatory = $false)]
19-
[switch]$Force
19+
[switch]$Force,
20+
21+
[Parameter(Mandatory = $false)]
22+
[switch]$Clean
2023
)
2124

2225
function Invoke-ScriptWithLogging {
@@ -293,6 +296,14 @@ try {
293296

294297
Write-ElapsedTime "npm ci complete"
295298

299+
if ($Clean) {
300+
Invoke-ScriptWithLogging { npm run clean -w $codegenFolderPath }
301+
if ($LASTEXITCODE -ne 0) {
302+
exit $LASTEXITCODE
303+
}
304+
Write-ElapsedTime "npm run clean complete"
305+
}
306+
296307
Invoke-ScriptWithLogging { npm run build -w $codegenFolderPath }
297308
if ($LASTEXITCODE -ne 0) {
298309
exit $LASTEXITCODE

0 commit comments

Comments
 (0)