22# and some ref (branch, tag, etc.) or commit hash. Only runs on PRs.
33# ContinueOnError - true: Pipeline warns on spelling error
44# false: Pipeline fails on spelling error
5- # TargetBranch - Target ref (e.g. main) to compare to create file change
6- # list.
75# CspellConfigPath - Path to cspell.json config location
86#
7+ # ScriptToValidateUpgrade - Optional script to validate cspell upgrade. This
8+ # is invoked only if package-lock.json for cspell is
9+ # changed. This script should exit with a nonzero exit
10+ # code if the upgrade is invalid. Upgrade check should
11+ # check for errors which would prevent release (i.e.
12+ # public API surface).
13+ #
914# This check recognizes the setting of variable "Skip.SpellCheck"
1015# if set to 'true', spellchecking will not be invoked.
1116
1217parameters :
13- ContinueOnError : true
14- CspellConfigPath : ./.vscode/cspell.json
18+ - name : ContinueOnError
19+ type : boolean
20+ default : true
21+ - name : CspellConfigPath
22+ type : string
23+ default : ./.vscode/cspell.json
24+ - name : ScriptToValidateUpgrade
25+ type : string
26+ default : ' '
1527
1628steps :
1729 - ${{ if eq(variables['Build.Reason'], 'PullRequest') }} :
@@ -26,3 +38,16 @@ steps:
2638 -CspellConfigPath ${{ parameters.CspellConfigPath }}
2739 -ExitWithError:(!$${{ parameters.ContinueOnError }})
2840 pwsh : true
41+ - ${{ if ne('', parameters.ScriptToValidateUpgrade) }} :
42+ - pwsh : |
43+ $changedFiles = ./eng/common/scripts/get-changedfiles.ps1
44+
45+ if ($changedFiles -notcontains 'eng/common/spelling/package-lock.json') {
46+ Write-Host "No changes to cspell package-lock.json detected."
47+ exit 0
48+ }
49+
50+ Write-Host "Detected change to cspell package-lock.json. Running upgrade verification."
51+ & '${{ parameters.ScriptToValidateUpgrade }}'
52+ displayName: Verify cspell upgrade
53+ condition: and(succeeded(), ne('true', variables['Skip.SpellCheck']))
0 commit comments