From 11e625596f028abba937360b40ee0d6b9314b5d5 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 9 Dec 2021 17:37:19 -0800 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 2417 (#3176) * Add logic for retrieving package infro from DevOps feed * Add template for docwarden * Remove Invoke-DevOpsAPI changes * Update verify readme logic Co-authored-by: Chidozie Ononiwu --- .../pipelines/templates/steps/verify-readme.yml | 17 +++++++++++++++++ eng/common/scripts/Verify-Readme.ps1 | 17 +++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 eng/common/pipelines/templates/steps/verify-readme.yml diff --git a/eng/common/pipelines/templates/steps/verify-readme.yml b/eng/common/pipelines/templates/steps/verify-readme.yml new file mode 100644 index 000000000..9d8d92fb7 --- /dev/null +++ b/eng/common/pipelines/templates/steps/verify-readme.yml @@ -0,0 +1,17 @@ +parameters: + ScanPath: $(Build.SourcesDirectory) + RepoRoot: $(Build.SourcesDirectory) + SettingsPath: '$(Build.SourcesDirectory)/eng/.docsettings.yml' + DocWardenVersion : '0.7.2' + +steps: +- task: PowerShell@2 + displayName: "Verify Readmes" + inputs: + filePath: "eng/common/scripts/Verify-Readme.ps1" + arguments: > + -DocWardenVersion ${{ parameters.DocWardenVersion }} + -ScanPath ${{ parameters.ScanPath }} + -RepoRoot ${{ parameters.RepoRoot }} + -SettingsPath ${{ parameters.SettingsPath }} + pwsh: true \ No newline at end of file diff --git a/eng/common/scripts/Verify-Readme.ps1 b/eng/common/scripts/Verify-Readme.ps1 index 67429fcc3..c02599340 100644 --- a/eng/common/scripts/Verify-Readme.ps1 +++ b/eng/common/scripts/Verify-Readme.ps1 @@ -1,15 +1,24 @@ # Wrapper Script for Readme Verification [CmdletBinding()] param ( - [string]$DocWardenVersion = "0.7.1", - + [Parameter(Mandatory = $true)] + [string]$DocWardenVersion, [Parameter(Mandatory = $true)] [string]$ScanPath, - + [string]$RepoRoot, [Parameter(Mandatory = $true)] [string]$SettingsPath ) pip install setuptools wheel --quiet pip install doc-warden==$DocWardenVersion --quiet -ward scan -d $ScanPath -c $SettingsPath + +if ($RepoRoot) +{ + ward scan -d $ScanPath -u $RepoRoot -c $SettingsPath +} +else +{ + ward scan -d $ScanPath -c $SettingsPath +} +