From c1cc54d6d22d2ea289b1f117a540532e94a856e6 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 17:38:35 +0000 Subject: [PATCH 01/18] CustomCondition --- .../templates/steps/check-spelling.yml | 79 ++++++++++++++----- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/eng/common/pipelines/templates/steps/check-spelling.yml b/eng/common/pipelines/templates/steps/check-spelling.yml index d5bfff5ea2d4..a7d2daa6b87c 100644 --- a/eng/common/pipelines/templates/steps/check-spelling.yml +++ b/eng/common/pipelines/templates/steps/check-spelling.yml @@ -5,10 +5,10 @@ # CspellConfigPath - Path to cspell.json config location # # ScriptToValidateUpgrade - Optional script to validate cspell upgrade. This -# is invoked only if package-lock.json for cspell is +# is invoked only if package-lock.json for cspell is # changed. This script should exit with a nonzero exit # code if the upgrade is invalid. Upgrade check should -# check for errors which would prevent release (i.e. +# check for errors which would prevent release (i.e. # public API surface). # # This check recognizes the setting of variable "Skip.SpellCheck" @@ -16,14 +16,17 @@ parameters: - name: ContinueOnError - type: boolean + type: string default: true - name: CspellConfigPath type: string default: ./.vscode/cspell.json - - name: ScriptToValidateUpgrade + - name: PublicApiCheckoutExpression + type: string + default: sdk/** + - name: ArtifactDirectory type: string - default: '' + default: $(Build.ArtifactStagingDirectory)/spelling-upgrade-check steps: - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: @@ -38,16 +41,56 @@ steps: -CspellConfigPath ${{ parameters.CspellConfigPath }} -ExitWithError:(!$${{ parameters.ContinueOnError }}) pwsh: true - - ${{ if ne('', parameters.ScriptToValidateUpgrade) }}: - - pwsh: | - $changedFiles = ./eng/common/scripts/get-changedfiles.ps1 - - if ($changedFiles -notcontains 'eng/common/spelling/package-lock.json') { - Write-Host "No changes to cspell package-lock.json detected." - exit 0 - } - - Write-Host "Detected change to cspell package-lock.json. Running upgrade verification." - & '${{ parameters.ScriptToValidateUpgrade }}' - displayName: Verify cspell upgrade - condition: and(succeeded(), ne('true', variables['Skip.SpellCheck'])) + + # If the repo has a spell-check-public-api.ps1 script and there is a change + # to the cspell package-lock.json, verify the upgrade. + - pwsh: | + $publicApiCheckExists = Test-Path 'eng/scripts/spell-check-public-api.ps1' + if (!$publicApiCheckExists) { + Write-Host "Public API spell check script not found. Skipping upgrade checks." + } + Write-Host "Changed Files:" + # TODO: Use a common script that lists changed files + git diff --name-only $(System.PullRequest.TargetBranch) | Tee-Object -Variable changedFiles + + if ($changedFiles -contains 'eng/common/spelling/package-lock.json') { + Write-Host "Detected change to cspell package-lock.json. Setting variables to run cspell upgrade verification." + New-Item -ItemType Directory -Path '${{ parameters.ArtifactDirectory }}' -Force | Out-Null + Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]true" + } else { + Write-Host "No changes to cspell package-lock.json detected." + Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]false" + } + + - checkout: self + path: $(Pipeline.Workspace)/public-api-before + sparseCheckoutPatterns: eng/** ${{ parameters.PublicApiCheckoutExpression }} + condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + + - pwsh: | + . ./eng/scripts/spell-check-public-api.ps1 ` + | Tee-Object -FilePath ${{ parameters.ArtifactDirectory }}/spelling-after.txt + condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + displayName: Get public API spelling errors after cspell upgrade + + - pwsh: | + . ./eng/scripts/spell-check-public-api.ps1 ` + | Tee-Object -FilePath ${{ parameters.ArtifactDirectory }}/spelling-before.txt + condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + displayName: Get public API spelling errors before cspell upgrade + workingDirectory: $(Pipeline.Workspace)/public-api-before + + # On Linux the diff command exits with a nonzero exit code if there is a + # diff. This step will fail if there are differences. + - pwsh: | + diff --unified ` + ${{ parameters.ArtifactDirectory }}/spelling-before.txt ` + ${{ parameters.ArtifactDirectory }}/spelling-after.txt | Tee-Object -FilePath ${{ parameters.ArtifactDirectory }}/spelling-diff.txt + condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + displayName: Compare public API spelling errors before and after cspell upgrade + + - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: cspell-upgrade-check + ArtifactPath: ${{ parameters.ArtifactDirectory }} + CustomCondition: and(succeededOrFailed(), eq(variables['RunCspellUpgradeVerification'], 'true')) From f416bcba9d907aeca84ca0c872419889e9d04854 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 22:50:09 +0000 Subject: [PATCH 02/18] Add spell-check-public-api.ps1 --- eng/scripts/spell-check-public-api.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 eng/scripts/spell-check-public-api.ps1 diff --git a/eng/scripts/spell-check-public-api.ps1 b/eng/scripts/spell-check-public-api.ps1 new file mode 100644 index 000000000000..706ef269439c --- /dev/null +++ b/eng/scripts/spell-check-public-api.ps1 @@ -0,0 +1,8 @@ +Set-StrictMode -Version 3.0 +."$PSScriptRoot/../common/scripts/common.ps1" + +$files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/*/*/api/*.cs" -File +Write-Host "Found $($files.Count) public API surface files to spell check." +."eng/common/spelling/Invoke-Cspell.ps1" ` + -CSpellConfigPath "./.vscode/cspell.json" ` + -FileList $files.FullName From bf4c067f3712eb35494df598d49a6e6bea676792 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 22:50:25 +0000 Subject: [PATCH 03/18] Wire up check-spelling.yml --- eng/pipelines/templates/jobs/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 859769b3bb97..38a8dbeaf4b2 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -158,6 +158,9 @@ jobs: - template: /eng/common/pipelines/templates/steps/validate-filename.yml - template: /eng/common/pipelines/templates/steps/check-spelling.yml + parameters: + EnableCspellUpgradeVerification: true + CspellUpgradePublicApiCheckoutExpression: /sdk/*/*/api - template: /eng/common/pipelines/templates/steps/verify-links.yml parameters: From ac4bd63239b1e837afc80e120aa1a879d62fd8e3 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 22:50:33 +0000 Subject: [PATCH 04/18] TEST REVERT: check-spelling.yml --- .../templates/steps/check-spelling.yml | 128 +++++++++++------- 1 file changed, 79 insertions(+), 49 deletions(-) diff --git a/eng/common/pipelines/templates/steps/check-spelling.yml b/eng/common/pipelines/templates/steps/check-spelling.yml index a7d2daa6b87c..a3ac0c69ab1e 100644 --- a/eng/common/pipelines/templates/steps/check-spelling.yml +++ b/eng/common/pipelines/templates/steps/check-spelling.yml @@ -21,10 +21,13 @@ parameters: - name: CspellConfigPath type: string default: ./.vscode/cspell.json - - name: PublicApiCheckoutExpression + - name: EnableCspellUpgradeVerification + type: boolean + default: false + - name: CspellUpgradePublicApiCheckoutExpression type: string - default: sdk/** - - name: ArtifactDirectory + default: /sdk/** + - name: CspellUpgradeArtifactDirectory type: string default: $(Build.ArtifactStagingDirectory)/spelling-upgrade-check @@ -42,55 +45,82 @@ steps: -ExitWithError:(!$${{ parameters.ContinueOnError }}) pwsh: true - # If the repo has a spell-check-public-api.ps1 script and there is a change - # to the cspell package-lock.json, verify the upgrade. - - pwsh: | - $publicApiCheckExists = Test-Path 'eng/scripts/spell-check-public-api.ps1' - if (!$publicApiCheckExists) { - Write-Host "Public API spell check script not found. Skipping upgrade checks." - } - Write-Host "Changed Files:" - # TODO: Use a common script that lists changed files - git diff --name-only $(System.PullRequest.TargetBranch) | Tee-Object -Variable changedFiles + - ${{ if eq(parameters.EnableCspellUpgradeVerification, true) }}: + # If the repo has a spell-check-public-api.ps1 script and there is a change + # to the cspell package-lock.json, verify the upgrade. + - pwsh: | + if ('true' -eq '$(Skip.SpellCheck)') { + Write-Host "Spell check is skipped in this build. Skipping cspell upgrade verification." + Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]false" + exit 0 + } + $publicApiCheckExists = Test-Path 'eng/scripts/spell-check-public-api.ps1' + if (!$publicApiCheckExists) { + Write-Host "Public API spell check script not found. Skipping upgrade checks." + } + Write-Host "Changed Files:" + ./eng/common/scripts/Generate-PR-Diff.ps1 ` + -TargetPath '.' ` + -ArtifactPath '$(ArtifactStagingDirectory)' + $changedFiles = (Get-Content '$(ArtifactStagingDirectory)/diff.json' | ConvertFrom-Json).ChangedFiles + Write-Host $changedFiles - if ($changedFiles -contains 'eng/common/spelling/package-lock.json') { - Write-Host "Detected change to cspell package-lock.json. Setting variables to run cspell upgrade verification." - New-Item -ItemType Directory -Path '${{ parameters.ArtifactDirectory }}' -Force | Out-Null - Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]true" - } else { - Write-Host "No changes to cspell package-lock.json detected." - Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]false" - } + if ($changedFiles -contains 'eng/common/spelling/package-lock.json') { + Write-Host "Detected change to cspell package-lock.json. Setting variables to run cspell upgrade verification." + New-Item -ItemType Directory -Path '${{ parameters.CspellUpgradeArtifactDirectory }}' -Force | Out-Null + Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]true" + } else { + Write-Host "No changes to cspell package-lock.json detected." + Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]false" + } + displayName: Determine if cspell upgrade verification is needed - - checkout: self - path: $(Pipeline.Workspace)/public-api-before - sparseCheckoutPatterns: eng/** ${{ parameters.PublicApiCheckoutExpression }} - condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + # Using the checkout task interferes with the job's existing checkout. + # sparse-checkout.yml cannot be used here because it doesn't use runtime + # conditions to determine if it should run + - pwsh: | + git clone ` + --no-checkout ` + --filter=tree:0 ` + --branch $(System.PullRequest.TargetBranch) ` + $(Build.Repository.Uri) ` + $(Pipeline.Workspace)/public-api-before - - pwsh: | - . ./eng/scripts/spell-check-public-api.ps1 ` - | Tee-Object -FilePath ${{ parameters.ArtifactDirectory }}/spelling-after.txt - condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) - displayName: Get public API spelling errors after cspell upgrade + Set-Location $(Pipeline.Workspace)/public-api-before + git sparse-checkout init + git sparse-checkout set --no-cone '/*' '!/*/' '/eng' '/.vscode' '${{ parameters.CspellUpgradePublicApiCheckoutExpression }}' + git checkout $(System.PullRequest.TargetBranch) + condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + displayName: Sparse checkout before state of public API surface area - - pwsh: | - . ./eng/scripts/spell-check-public-api.ps1 ` - | Tee-Object -FilePath ${{ parameters.ArtifactDirectory }}/spelling-before.txt - condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) - displayName: Get public API spelling errors before cspell upgrade - workingDirectory: $(Pipeline.Workspace)/public-api-before + - pwsh: | + ./eng/scripts/spell-check-public-api.ps1 > '${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-after.txt' + Get-Content '${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-after.txt' + condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + displayName: Get public API spelling errors after cspell upgrade + # It's possible that cspell found errors, don't fail the build + ignoreLASTEXITCODE: true - # On Linux the diff command exits with a nonzero exit code if there is a - # diff. This step will fail if there are differences. - - pwsh: | - diff --unified ` - ${{ parameters.ArtifactDirectory }}/spelling-before.txt ` - ${{ parameters.ArtifactDirectory }}/spelling-after.txt | Tee-Object -FilePath ${{ parameters.ArtifactDirectory }}/spelling-diff.txt - condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) - displayName: Compare public API spelling errors before and after cspell upgrade + - pwsh: | + ./eng/scripts/spell-check-public-api.ps1 > '${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-before.txt' + Get-Content '${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-before.txt' + condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + displayName: Get public API spelling errors before cspell upgrade + # It's possible that cspell found errors, don't fail the build + ignoreLASTEXITCODE: true + workingDirectory: $(Pipeline.Workspace)/public-api-before - - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml - parameters: - ArtifactName: cspell-upgrade-check - ArtifactPath: ${{ parameters.ArtifactDirectory }} - CustomCondition: and(succeededOrFailed(), eq(variables['RunCspellUpgradeVerification'], 'true')) + # On Linux the diff command exits with a nonzero exit code if there is a + # diff. This step will fail if there are differences. + - pwsh: | + diff --unified ` + ${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-before.txt ` + ${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-after.txt | Tee-Object -FilePath ${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-diff.txt + condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) + displayName: Compare public API spelling errors before and after cspell upgrade + + - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml + parameters: + ArtifactName: cspell-upgrade-check + ArtifactPath: ${{ parameters.CspellUpgradeArtifactDirectory }} + CustomCondition: and(succeededOrFailed(), eq(variables['RunCspellUpgradeVerification'], 'true')) From 7cc3fd3afd31adf66b8ce99200a69dba14be479b Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 23:11:32 +0000 Subject: [PATCH 05/18] TEST REVERT: Trivial change to eng/spelling/package-lock.json --- eng/common/spelling/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/spelling/package-lock.json b/eng/common/spelling/package-lock.json index a028f4a1110e..5d07558fb33b 100644 --- a/eng/common/spelling/package-lock.json +++ b/eng/common/spelling/package-lock.json @@ -1,4 +1,4 @@ -{ +{ "name": "cspell-version-pin", "version": "1.0.0", "lockfileVersion": 2, From 42917ec93803821641f70020486d4b012b2462a6 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 23:25:30 +0000 Subject: [PATCH 06/18] Fix check-spelling.yml --- .../templates/steps/check-spelling.yml | 69 ++----------------- 1 file changed, 6 insertions(+), 63 deletions(-) diff --git a/eng/common/pipelines/templates/steps/check-spelling.yml b/eng/common/pipelines/templates/steps/check-spelling.yml index a3ac0c69ab1e..9e2d42ddc62a 100644 --- a/eng/common/pipelines/templates/steps/check-spelling.yml +++ b/eng/common/pipelines/templates/steps/check-spelling.yml @@ -16,7 +16,7 @@ parameters: - name: ContinueOnError - type: string + type: boolean default: true - name: CspellConfigPath type: string @@ -24,12 +24,6 @@ parameters: - name: EnableCspellUpgradeVerification type: boolean default: false - - name: CspellUpgradePublicApiCheckoutExpression - type: string - default: /sdk/** - - name: CspellUpgradeArtifactDirectory - type: string - default: $(Build.ArtifactStagingDirectory)/spelling-upgrade-check steps: - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: @@ -65,62 +59,11 @@ steps: $changedFiles = (Get-Content '$(ArtifactStagingDirectory)/diff.json' | ConvertFrom-Json).ChangedFiles Write-Host $changedFiles - if ($changedFiles -contains 'eng/common/spelling/package-lock.json') { - Write-Host "Detected change to cspell package-lock.json. Setting variables to run cspell upgrade verification." - New-Item -ItemType Directory -Path '${{ parameters.CspellUpgradeArtifactDirectory }}' -Force | Out-Null - Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]true" - } else { + if ($changedFiles -notcontains 'eng/common/spelling/package-lock.json') { Write-Host "No changes to cspell package-lock.json detected." - Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]false" + exit 0 } - displayName: Determine if cspell upgrade verification is needed - - # Using the checkout task interferes with the job's existing checkout. - # sparse-checkout.yml cannot be used here because it doesn't use runtime - # conditions to determine if it should run - - pwsh: | - git clone ` - --no-checkout ` - --filter=tree:0 ` - --branch $(System.PullRequest.TargetBranch) ` - $(Build.Repository.Uri) ` - $(Pipeline.Workspace)/public-api-before - - Set-Location $(Pipeline.Workspace)/public-api-before - git sparse-checkout init - git sparse-checkout set --no-cone '/*' '!/*/' '/eng' '/.vscode' '${{ parameters.CspellUpgradePublicApiCheckoutExpression }}' - git checkout $(System.PullRequest.TargetBranch) - condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) - displayName: Sparse checkout before state of public API surface area - - - pwsh: | - ./eng/scripts/spell-check-public-api.ps1 > '${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-after.txt' - Get-Content '${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-after.txt' - condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) - displayName: Get public API spelling errors after cspell upgrade - # It's possible that cspell found errors, don't fail the build - ignoreLASTEXITCODE: true - - - pwsh: | - ./eng/scripts/spell-check-public-api.ps1 > '${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-before.txt' - Get-Content '${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-before.txt' - condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) - displayName: Get public API spelling errors before cspell upgrade - # It's possible that cspell found errors, don't fail the build - ignoreLASTEXITCODE: true - workingDirectory: $(Pipeline.Workspace)/public-api-before - - # On Linux the diff command exits with a nonzero exit code if there is a - # diff. This step will fail if there are differences. - - pwsh: | - diff --unified ` - ${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-before.txt ` - ${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-after.txt | Tee-Object -FilePath ${{ parameters.CspellUpgradeArtifactDirectory }}/spelling-diff.txt - condition: and(succeeded(), eq(variables['RunCspellUpgradeVerification'], 'true')) - displayName: Compare public API spelling errors before and after cspell upgrade - - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml - parameters: - ArtifactName: cspell-upgrade-check - ArtifactPath: ${{ parameters.CspellUpgradeArtifactDirectory }} - CustomCondition: and(succeededOrFailed(), eq(variables['RunCspellUpgradeVerification'], 'true')) + Write-Host "Detected change to cspell package-lock.json. Running upgrade verification." + ./eng/scripts/spell-check-public-api.ps1 + displayName: Verify cspell upgrade From af90f092762f8e2b24f144d0a31e07866a0020b7 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 23:28:29 +0000 Subject: [PATCH 07/18] exit 0 --- eng/common/pipelines/templates/steps/check-spelling.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/common/pipelines/templates/steps/check-spelling.yml b/eng/common/pipelines/templates/steps/check-spelling.yml index 9e2d42ddc62a..c8854e5f2a74 100644 --- a/eng/common/pipelines/templates/steps/check-spelling.yml +++ b/eng/common/pipelines/templates/steps/check-spelling.yml @@ -51,6 +51,7 @@ steps: $publicApiCheckExists = Test-Path 'eng/scripts/spell-check-public-api.ps1' if (!$publicApiCheckExists) { Write-Host "Public API spell check script not found. Skipping upgrade checks." + exit 0 } Write-Host "Changed Files:" ./eng/common/scripts/Generate-PR-Diff.ps1 ` From c7c34a5951991a3baa6dc92d806a845b6898af2f Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 23:29:15 +0000 Subject: [PATCH 08/18] Add baseline --- sdk/recoveryservices/cspell.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 sdk/recoveryservices/cspell.yaml diff --git a/sdk/recoveryservices/cspell.yaml b/sdk/recoveryservices/cspell.yaml new file mode 100644 index 000000000000..17ffd65ed593 --- /dev/null +++ b/sdk/recoveryservices/cspell.yaml @@ -0,0 +1,6 @@ +import: + - ../../.vscode/cspell.json +overrides: + - filename: '**/sdk/recoveryservices/**' + words: + - bcdr From e06fb0a335dc41a3967092064e6fc67b214e5498 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 23:34:16 +0000 Subject: [PATCH 09/18] Remove extra param --- eng/pipelines/templates/jobs/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 38a8dbeaf4b2..7db0bbb70ba4 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -160,7 +160,6 @@ jobs: - template: /eng/common/pipelines/templates/steps/check-spelling.yml parameters: EnableCspellUpgradeVerification: true - CspellUpgradePublicApiCheckoutExpression: /sdk/*/*/api - template: /eng/common/pipelines/templates/steps/verify-links.yml parameters: From 5fc86096e8787dc2fc6b8d2f4edfc9ae765a48f8 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 23:44:51 +0000 Subject: [PATCH 10/18] Test misspelling --- .../api/Azure.ResourceManager.RecoveryServices.net8.0.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.net8.0.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.net8.0.cs index e16d90f121d0..194c20cfc3c5 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.net8.0.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.net8.0.cs @@ -1,3 +1,5 @@ +// Tset misssssepelling + namespace Azure.ResourceManager.RecoveryServices { public partial class AzureResourceManagerRecoveryServicesContext : System.ClientModel.Primitives.ModelReaderWriterContext From 292f8adacd65a9cf04fe42a6086681731e9ce94f Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Fri, 14 Nov 2025 23:54:05 +0000 Subject: [PATCH 11/18] Revert test changes --- .../templates/steps/check-spelling.yml | 43 ++----------------- eng/common/spelling/package-lock.json | 2 +- ...ResourceManager.RecoveryServices.net8.0.cs | 2 - 3 files changed, 5 insertions(+), 42 deletions(-) diff --git a/eng/common/pipelines/templates/steps/check-spelling.yml b/eng/common/pipelines/templates/steps/check-spelling.yml index c8854e5f2a74..a2b2b90f4991 100644 --- a/eng/common/pipelines/templates/steps/check-spelling.yml +++ b/eng/common/pipelines/templates/steps/check-spelling.yml @@ -2,6 +2,8 @@ # and some ref (branch, tag, etc.) or commit hash. Only runs on PRs. # ContinueOnError - true: Pipeline warns on spelling error # false: Pipeline fails on spelling error +# TargetBranch - Target ref (e.g. main) to compare to create file change +# list. # CspellConfigPath - Path to cspell.json config location # # ScriptToValidateUpgrade - Optional script to validate cspell upgrade. This @@ -15,15 +17,8 @@ # if set to 'true', spellchecking will not be invoked. parameters: - - name: ContinueOnError - type: boolean - default: true - - name: CspellConfigPath - type: string - default: ./.vscode/cspell.json - - name: EnableCspellUpgradeVerification - type: boolean - default: false + ContinueOnError: true + CspellConfigPath: ./.vscode/cspell.json steps: - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: @@ -38,33 +33,3 @@ steps: -CspellConfigPath ${{ parameters.CspellConfigPath }} -ExitWithError:(!$${{ parameters.ContinueOnError }}) pwsh: true - - - ${{ if eq(parameters.EnableCspellUpgradeVerification, true) }}: - # If the repo has a spell-check-public-api.ps1 script and there is a change - # to the cspell package-lock.json, verify the upgrade. - - pwsh: | - if ('true' -eq '$(Skip.SpellCheck)') { - Write-Host "Spell check is skipped in this build. Skipping cspell upgrade verification." - Write-Host "##vso[task.setvariable variable=RunCspellUpgradeVerification]false" - exit 0 - } - $publicApiCheckExists = Test-Path 'eng/scripts/spell-check-public-api.ps1' - if (!$publicApiCheckExists) { - Write-Host "Public API spell check script not found. Skipping upgrade checks." - exit 0 - } - Write-Host "Changed Files:" - ./eng/common/scripts/Generate-PR-Diff.ps1 ` - -TargetPath '.' ` - -ArtifactPath '$(ArtifactStagingDirectory)' - $changedFiles = (Get-Content '$(ArtifactStagingDirectory)/diff.json' | ConvertFrom-Json).ChangedFiles - Write-Host $changedFiles - - if ($changedFiles -notcontains 'eng/common/spelling/package-lock.json') { - Write-Host "No changes to cspell package-lock.json detected." - exit 0 - } - - Write-Host "Detected change to cspell package-lock.json. Running upgrade verification." - ./eng/scripts/spell-check-public-api.ps1 - displayName: Verify cspell upgrade diff --git a/eng/common/spelling/package-lock.json b/eng/common/spelling/package-lock.json index 5d07558fb33b..a028f4a1110e 100644 --- a/eng/common/spelling/package-lock.json +++ b/eng/common/spelling/package-lock.json @@ -1,4 +1,4 @@ -{ +{ "name": "cspell-version-pin", "version": "1.0.0", "lockfileVersion": 2, diff --git a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.net8.0.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.net8.0.cs index 194c20cfc3c5..e16d90f121d0 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.net8.0.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/api/Azure.ResourceManager.RecoveryServices.net8.0.cs @@ -1,5 +1,3 @@ -// Tset misssssepelling - namespace Azure.ResourceManager.RecoveryServices { public partial class AzureResourceManagerRecoveryServicesContext : System.ClientModel.Primitives.ModelReaderWriterContext From 16ab24560f4729337021e72824ef57f6b6b9a6ec Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Mon, 17 Nov 2025 21:57:06 +0000 Subject: [PATCH 12/18] Review feedback --- eng/pipelines/templates/jobs/ci.yml | 2 +- eng/scripts/spell-check-public-api.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 7db0bbb70ba4..255b77f647ac 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -159,7 +159,7 @@ jobs: - template: /eng/common/pipelines/templates/steps/check-spelling.yml parameters: - EnableCspellUpgradeVerification: true + ScriptToValidateUpgrade: eng/scripts/spell-check-public-api.ps1 - template: /eng/common/pipelines/templates/steps/verify-links.yml parameters: diff --git a/eng/scripts/spell-check-public-api.ps1 b/eng/scripts/spell-check-public-api.ps1 index 706ef269439c..4d1e5e4e114e 100644 --- a/eng/scripts/spell-check-public-api.ps1 +++ b/eng/scripts/spell-check-public-api.ps1 @@ -3,6 +3,6 @@ Set-StrictMode -Version 3.0 $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/*/*/api/*.cs" -File Write-Host "Found $($files.Count) public API surface files to spell check." -."eng/common/spelling/Invoke-Cspell.ps1" ` +."$PSScriptRoot/../common/spelling/Invoke-Cspell.ps1" ` -CSpellConfigPath "./.vscode/cspell.json" ` -FileList $files.FullName From b90d1681d5fb88380bee36b5f1fb4d8421902c69 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Tue, 18 Nov 2025 00:08:12 +0000 Subject: [PATCH 13/18] Review feedback --- eng/scripts/Export-API.ps1 | 6 +++--- eng/scripts/spell-check-public-api.ps1 | 14 +++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/eng/scripts/Export-API.ps1 b/eng/scripts/Export-API.ps1 index 6c680dfe0086..b9a2050dfaaa 100644 --- a/eng/scripts/Export-API.ps1 +++ b/eng/scripts/Export-API.ps1 @@ -51,9 +51,9 @@ foreach ($file in $apiListingFiles) { } if ($SpellCheckPublicApiSurface) { - Write-Host "Spell check public API surface (found $($apiListingFiles.Count) files)" - &"$PSScriptRoot/../common/spelling/Invoke-Cspell.ps1" ` - -FileList $apiListingFiles.FullName + Write-Host "Spell check public API surface" + &"$PSScriptRoot/spell-check-public-api.ps1" ` + -ServiceDirectory $ServiceDirectory if ($LASTEXITCODE) { Write-Host "##vso[task.LogIssue type=error;]Spelling errors detected. To correct false positives or learn about spell checking see: https://aka.ms/azsdk/engsys/spellcheck" diff --git a/eng/scripts/spell-check-public-api.ps1 b/eng/scripts/spell-check-public-api.ps1 index 4d1e5e4e114e..5432c85612ff 100644 --- a/eng/scripts/spell-check-public-api.ps1 +++ b/eng/scripts/spell-check-public-api.ps1 @@ -1,7 +1,19 @@ +param( + [Parameter(mandatory = $false)] + $ServiceDirectory = '' +) + Set-StrictMode -Version 3.0 ."$PSScriptRoot/../common/scripts/common.ps1" -$files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/*/*/api/*.cs" -File +$files = @() +if ($ServiceDirectory) { + $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/$ServiceDirectory/*/api/*.cs" -File +} else { + $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/*/*/api/*.cs" -File +} + + Write-Host "Found $($files.Count) public API surface files to spell check." ."$PSScriptRoot/../common/spelling/Invoke-Cspell.ps1" ` -CSpellConfigPath "./.vscode/cspell.json" ` From b9cd31939938a81826c538c9918790360c90f996 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 19 Nov 2025 04:06:32 +0000 Subject: [PATCH 14/18] Add support for RelativePackagePath or ServiceDirectory --- eng/scripts/Export-API.ps1 | 41 +++++++++++++++++++++----- eng/scripts/spell-check-public-api.ps1 | 11 +++++-- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/eng/scripts/Export-API.ps1 b/eng/scripts/Export-API.ps1 index b9a2050dfaaa..517b6ea89b29 100644 --- a/eng/scripts/Export-API.ps1 +++ b/eng/scripts/Export-API.ps1 @@ -1,6 +1,8 @@ [CmdletBinding()] param ( - [Parameter(Position=0, Mandatory=$true, ParameterSetName='ServiceDirectory')] + [Parameter(Position=0)] + + [Parameter(Mandatory=$true, ParameterSetName='ServiceDirectory')] [string] $ServiceDirectory, [string] $SDKType = "all", @@ -16,9 +18,6 @@ if ($SpellCheckPublicApiSurface -and -not (Get-Command 'npx')) { Write-Error "Could not locate npx. Install NodeJS (includes npm and npx) https://nodejs.org/en/download/" exit 1 } - -. $PSScriptRoot/../common/scripts/Helpers/CommandInvocation-Helpers.ps1 - $relativePackagePath = $ServiceDirectory $apiListingFilesFilter = "$PSScriptRoot/../../sdk/$ServiceDirectory/*/api/*.cs" @@ -33,11 +32,31 @@ $debugLogging = $env:SYSTEM_DEBUG -eq "true" $logsFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY $diagnosticArguments = ($debugLogging -and $logsFolder) ? "/binarylogger:$logsFolder/exportapi.binlog" : "" -Invoke-LoggedMsbuildCommand "dotnet build /t:ExportApi /p:RunApiCompat=false /p:InheritDocEnabled=false /p:GeneratePackageOnBuild=false /p:Configuration=Release /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:IncludeTests=false /p:Scope=`"$relativePackagePath`" /p:SDKType=$SDKType /restore $servicesProj $diagnosticArguments" +dotnet build ` + /t:ExportApi ` + /p:RunApiCompat=false ` + /p:InheritDocEnabled=false ` + /p:GeneratePackageOnBuild=false ` + /p:Configuration=Release ` + /p:IncludeSamples=false ` + /p:IncludePerf=false ` + /p:IncludeStress=false ` + /p:IncludeTests=false ` + /p:Scope="$relativePackagePath" ` + /p:SDKType=$SDKType ` + /restore ` + $servicesProj ` + $diagnosticArguments + +if ($LASTEXITCODE) { + Write-Host "##vso[task.LogIssue type=error;]API export failed. See the build logs for details." + exit $LASTEXITCODE +} # Normalize line endings to LF in generated API listing files Write-Host "Normalizing line endings in API listing files" -$apiListingFiles = Get-ChildItem -Path $apiListingFilesFilter -ErrorAction SilentlyContinue +$apiListingFiles = Get-ChildItem -Path $apiListingFilesFilter +$apiListingFiles | Write-Host foreach ($file in $apiListingFiles) { $content = Get-Content -Path $file.FullName -Raw if ($content) { @@ -52,8 +71,14 @@ foreach ($file in $apiListingFiles) { if ($SpellCheckPublicApiSurface) { Write-Host "Spell check public API surface" - &"$PSScriptRoot/spell-check-public-api.ps1" ` - -ServiceDirectory $ServiceDirectory + + if ($PSCmdlet.ParameterSetName -eq 'PackagePath') { + &"$PSScriptRoot/spell-check-public-api.ps1" ` + -RelativePackagePath $relativePackagePath + } else { + &"$PSScriptRoot/spell-check-public-api.ps1" ` + -ServiceDirectory $relativePackagePath + } if ($LASTEXITCODE) { Write-Host "##vso[task.LogIssue type=error;]Spelling errors detected. To correct false positives or learn about spell checking see: https://aka.ms/azsdk/engsys/spellcheck" diff --git a/eng/scripts/spell-check-public-api.ps1 b/eng/scripts/spell-check-public-api.ps1 index 5432c85612ff..e2ac63ac5ced 100644 --- a/eng/scripts/spell-check-public-api.ps1 +++ b/eng/scripts/spell-check-public-api.ps1 @@ -1,19 +1,24 @@ param( - [Parameter(mandatory = $false)] - $ServiceDirectory = '' + $ServiceDirectory = '', + $RelativePackagePath = '' ) +if ($ServiceDirectory -and $RelativePackagePath) { + throw "Cannot specify both ServiceDirectory and RelativePackagePath parameters." +} + Set-StrictMode -Version 3.0 ."$PSScriptRoot/../common/scripts/common.ps1" $files = @() if ($ServiceDirectory) { $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/$ServiceDirectory/*/api/*.cs" -File +} elseif ($RelativePackagePath) { + $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/$RelativePackagePath/api/*.cs" -File } else { $files = Get-ChildItem -Path "$PSScriptRoot/../../sdk/*/*/api/*.cs" -File } - Write-Host "Found $($files.Count) public API surface files to spell check." ."$PSScriptRoot/../common/spelling/Invoke-Cspell.ps1" ` -CSpellConfigPath "./.vscode/cspell.json" ` From 2939995acd52f4d03aa8ad454c34393884bb4450 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 19 Nov 2025 04:08:21 +0000 Subject: [PATCH 15/18] Remove extra logging --- eng/scripts/Export-API.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/scripts/Export-API.ps1 b/eng/scripts/Export-API.ps1 index 517b6ea89b29..eda614b1544c 100644 --- a/eng/scripts/Export-API.ps1 +++ b/eng/scripts/Export-API.ps1 @@ -56,7 +56,6 @@ if ($LASTEXITCODE) { # Normalize line endings to LF in generated API listing files Write-Host "Normalizing line endings in API listing files" $apiListingFiles = Get-ChildItem -Path $apiListingFilesFilter -$apiListingFiles | Write-Host foreach ($file in $apiListingFiles) { $content = Get-Content -Path $file.FullName -Raw if ($content) { From 47cf0e602d296666ddba56dec8cf77a4b57addf5 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 19 Nov 2025 21:32:16 +0000 Subject: [PATCH 16/18] Use Export-API.ps1 from main --- eng/scripts/Export-API.ps1 | 42 ++++++++------------------------------ 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/eng/scripts/Export-API.ps1 b/eng/scripts/Export-API.ps1 index eda614b1544c..6c680dfe0086 100644 --- a/eng/scripts/Export-API.ps1 +++ b/eng/scripts/Export-API.ps1 @@ -1,8 +1,6 @@ [CmdletBinding()] param ( - [Parameter(Position=0)] - - [Parameter(Mandatory=$true, ParameterSetName='ServiceDirectory')] + [Parameter(Position=0, Mandatory=$true, ParameterSetName='ServiceDirectory')] [string] $ServiceDirectory, [string] $SDKType = "all", @@ -18,6 +16,9 @@ if ($SpellCheckPublicApiSurface -and -not (Get-Command 'npx')) { Write-Error "Could not locate npx. Install NodeJS (includes npm and npx) https://nodejs.org/en/download/" exit 1 } + +. $PSScriptRoot/../common/scripts/Helpers/CommandInvocation-Helpers.ps1 + $relativePackagePath = $ServiceDirectory $apiListingFilesFilter = "$PSScriptRoot/../../sdk/$ServiceDirectory/*/api/*.cs" @@ -32,30 +33,11 @@ $debugLogging = $env:SYSTEM_DEBUG -eq "true" $logsFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY $diagnosticArguments = ($debugLogging -and $logsFolder) ? "/binarylogger:$logsFolder/exportapi.binlog" : "" -dotnet build ` - /t:ExportApi ` - /p:RunApiCompat=false ` - /p:InheritDocEnabled=false ` - /p:GeneratePackageOnBuild=false ` - /p:Configuration=Release ` - /p:IncludeSamples=false ` - /p:IncludePerf=false ` - /p:IncludeStress=false ` - /p:IncludeTests=false ` - /p:Scope="$relativePackagePath" ` - /p:SDKType=$SDKType ` - /restore ` - $servicesProj ` - $diagnosticArguments - -if ($LASTEXITCODE) { - Write-Host "##vso[task.LogIssue type=error;]API export failed. See the build logs for details." - exit $LASTEXITCODE -} +Invoke-LoggedMsbuildCommand "dotnet build /t:ExportApi /p:RunApiCompat=false /p:InheritDocEnabled=false /p:GeneratePackageOnBuild=false /p:Configuration=Release /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false /p:IncludeTests=false /p:Scope=`"$relativePackagePath`" /p:SDKType=$SDKType /restore $servicesProj $diagnosticArguments" # Normalize line endings to LF in generated API listing files Write-Host "Normalizing line endings in API listing files" -$apiListingFiles = Get-ChildItem -Path $apiListingFilesFilter +$apiListingFiles = Get-ChildItem -Path $apiListingFilesFilter -ErrorAction SilentlyContinue foreach ($file in $apiListingFiles) { $content = Get-Content -Path $file.FullName -Raw if ($content) { @@ -69,15 +51,9 @@ foreach ($file in $apiListingFiles) { } if ($SpellCheckPublicApiSurface) { - Write-Host "Spell check public API surface" - - if ($PSCmdlet.ParameterSetName -eq 'PackagePath') { - &"$PSScriptRoot/spell-check-public-api.ps1" ` - -RelativePackagePath $relativePackagePath - } else { - &"$PSScriptRoot/spell-check-public-api.ps1" ` - -ServiceDirectory $relativePackagePath - } + Write-Host "Spell check public API surface (found $($apiListingFiles.Count) files)" + &"$PSScriptRoot/../common/spelling/Invoke-Cspell.ps1" ` + -FileList $apiListingFiles.FullName if ($LASTEXITCODE) { Write-Host "##vso[task.LogIssue type=error;]Spelling errors detected. To correct false positives or learn about spell checking see: https://aka.ms/azsdk/engsys/spellcheck" From a45d38fb899f219a426224e540f1211817d876e9 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 19 Nov 2025 21:34:13 +0000 Subject: [PATCH 17/18] Use scenario-specific spell-check-public-api.ps1 --- eng/scripts/Export-API.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/eng/scripts/Export-API.ps1 b/eng/scripts/Export-API.ps1 index 6c680dfe0086..c3b04fc21857 100644 --- a/eng/scripts/Export-API.ps1 +++ b/eng/scripts/Export-API.ps1 @@ -51,11 +51,18 @@ foreach ($file in $apiListingFiles) { } if ($SpellCheckPublicApiSurface) { - Write-Host "Spell check public API surface (found $($apiListingFiles.Count) files)" - &"$PSScriptRoot/../common/spelling/Invoke-Cspell.ps1" ` - -FileList $apiListingFiles.FullName + Write-Host "Spell check public API surface" + + if ($PSCmdlet.ParameterSetName -eq 'PackagePath') { + &"$PSScriptRoot/spell-check-public-api.ps1" ` + -RelativePackagePath $relativePackagePath + } else { + &"$PSScriptRoot/spell-check-public-api.ps1" ` + -ServiceDirectory $relativePackagePath + } if ($LASTEXITCODE) { Write-Host "##vso[task.LogIssue type=error;]Spelling errors detected. To correct false positives or learn about spell checking see: https://aka.ms/azsdk/engsys/spellcheck" + exit $LASTEXITCODE } } From 644b8d41dc9ed2a1e6839053ae476bfb1a4f76c9 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Wed, 19 Nov 2025 13:42:47 -0800 Subject: [PATCH 18/18] Revert check-spelling.yml --- .../templates/steps/check-spelling.yml | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/eng/common/pipelines/templates/steps/check-spelling.yml b/eng/common/pipelines/templates/steps/check-spelling.yml index a2b2b90f4991..d5bfff5ea2d4 100644 --- a/eng/common/pipelines/templates/steps/check-spelling.yml +++ b/eng/common/pipelines/templates/steps/check-spelling.yml @@ -2,23 +2,28 @@ # and some ref (branch, tag, etc.) or commit hash. Only runs on PRs. # ContinueOnError - true: Pipeline warns on spelling error # false: Pipeline fails on spelling error -# TargetBranch - Target ref (e.g. main) to compare to create file change -# list. # CspellConfigPath - Path to cspell.json config location # # ScriptToValidateUpgrade - Optional script to validate cspell upgrade. This -# is invoked only if package-lock.json for cspell is +# is invoked only if package-lock.json for cspell is # changed. This script should exit with a nonzero exit # code if the upgrade is invalid. Upgrade check should -# check for errors which would prevent release (i.e. +# check for errors which would prevent release (i.e. # public API surface). # # This check recognizes the setting of variable "Skip.SpellCheck" # if set to 'true', spellchecking will not be invoked. parameters: - ContinueOnError: true - CspellConfigPath: ./.vscode/cspell.json + - name: ContinueOnError + type: boolean + default: true + - name: CspellConfigPath + type: string + default: ./.vscode/cspell.json + - name: ScriptToValidateUpgrade + type: string + default: '' steps: - ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: @@ -33,3 +38,16 @@ steps: -CspellConfigPath ${{ parameters.CspellConfigPath }} -ExitWithError:(!$${{ parameters.ContinueOnError }}) pwsh: true + - ${{ if ne('', parameters.ScriptToValidateUpgrade) }}: + - pwsh: | + $changedFiles = ./eng/common/scripts/get-changedfiles.ps1 + + if ($changedFiles -notcontains 'eng/common/spelling/package-lock.json') { + Write-Host "No changes to cspell package-lock.json detected." + exit 0 + } + + Write-Host "Detected change to cspell package-lock.json. Running upgrade verification." + & '${{ parameters.ScriptToValidateUpgrade }}' + displayName: Verify cspell upgrade + condition: and(succeeded(), ne('true', variables['Skip.SpellCheck']))