Skip to content

Commit f808020

Browse files
Sync eng/common directory with azure-sdk-tools for PR 12910 (#36636)
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#12910 See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow) --------- Co-authored-by: Daniel Jurek <[email protected]>
1 parent e9d2bc5 commit f808020

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

eng/common/pipelines/templates/steps/check-spelling.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,28 @@
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

1217
parameters:
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

1628
steps:
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

Comments
 (0)