@@ -14,9 +14,9 @@ parameters:
1414 - name : CspellConfigPath
1515 type : string
1616 default : ./.vscode/cspell.json
17- - name : EnableCspellUpgradeVerification
18- type : boolean
19- default : false
17+ - name : ScriptToValidateUpgrade
18+ type : string
19+ default : ' '
2020
2121steps :
2222 - ${{ if eq(variables['Build.Reason'], 'PullRequest') }} :
@@ -32,32 +32,20 @@ steps:
3232 -ExitWithError:(!$${{ parameters.ContinueOnError }})
3333 pwsh : true
3434
35- - ${{ if eq(parameters.EnableCspellUpgradeVerification, true) }} :
36- # If the repo has a spell-check-public-api.ps1 script and there is a change
37- # to the cspell package-lock.json, verify the upgrade.
38- - pwsh : |
39- if ('true' -eq '$(Skip.SpellCheck)') {
40- Write-Host "Spell check is skipped in this build. Skipping cspell upgrade verification."
41- Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]false"
42- exit 0
43- }
44- $publicApiCheckExists = Test-Path 'eng/scripts/spell-check-public-api.ps1'
45- if (!$publicApiCheckExists) {
46- Write-Host "Public API spell check script not found. Skipping upgrade checks."
47- exit 0
48- }
49- Write-Host "Changed Files:"
50- ./eng/common/scripts/Generate-PR-Diff.ps1 `
51- -TargetPath '.' `
52- -ArtifactPath '$(ArtifactStagingDirectory)'
53- $changedFiles = (Get-Content '$(ArtifactStagingDirectory)/diff.json' | ConvertFrom-Json).ChangedFiles
54- Write-Host $changedFiles
35+ - pwsh : |
36+ $changedFiles = ./eng/common/scripts/get-changedfiles.ps1
5537
56- if ($changedFiles -notcontains 'eng/common/spelling/package-lock.json') {
57- Write-Host "No changes to cspell package-lock.json detected."
58- exit 0
59- }
38+ if ($changedFiles -notcontains 'eng/common/spelling/package-lock.json') {
39+ Write-Host "No changes to cspell package-lock.json detected."
40+ exit 0
41+ }
6042
61- Write-Host "Detected change to cspell package-lock.json. Running upgrade verification."
62- ./eng/scripts/spell-check-public-api.ps1
63- displayName: Verify cspell upgrade
43+ Write-Host "Detected change to cspell package-lock.json. Running upgrade verification."
44+ & '${{ parameters.ScriptToValidateUpgrade }}'
45+ displayName: Verify cspell upgrade
46+ condition: >-
47+ and(
48+ succeeded(),
49+ ne('true', variables['Skip.SpellCheck']),
50+ ne('', parameters.ScriptToValidateUpgrade)
51+ )
0 commit comments