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 00000000000..9d8d92fb7cb --- /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/Invoke-DevOpsAPI.ps1 b/eng/common/scripts/Invoke-DevOpsAPI.ps1 index 41f4796d42f..c887237914e 100644 --- a/eng/common/scripts/Invoke-DevOpsAPI.ps1 +++ b/eng/common/scripts/Invoke-DevOpsAPI.ps1 @@ -158,5 +158,26 @@ function Add-RetentionLease { -Headers (Get-DevOpsApiHeaders -Base64EncodedToken $Base64EncodedAuthToken) ` -MaximumRetryCount 3 ` -ContentType "application/json" +} + +function Get-PackagesInArtifactFeed { + param ( + $Organization="azure-sdk", + $Project="public", + [Parameter(Mandatory = $true)] + $FeedId, + $ApiVersion="6.1-preview.1", + $IncludeAllVersions="false", + $Base64EncodedAuthToken + ) + + $uri = "https://feeds.dev.azure.com/$Organization/$Project/_apis/packaging/Feeds/$FeedId/packages?api-version=$ApiVersion&includeAllVersions=$IncludeAllVersions" + + $packages = Invoke-RestMethod ` + -Method GET ` + -Uri $uri ` + -Headers (Get-DevOpsApiHeaders -Base64EncodedToken $Base64EncodedAuthToken) ` + -MaximumRetryCount 3 + return $packages.value } diff --git a/eng/common/scripts/Verify-Readme.ps1 b/eng/common/scripts/Verify-Readme.ps1 index 67429fcc3b2..d7ed446522a 100644 --- a/eng/common/scripts/Verify-Readme.ps1 +++ b/eng/common/scripts/Verify-Readme.ps1 @@ -1,15 +1,23 @@ # Wrapper Script for Readme Verification [CmdletBinding()] param ( - [string]$DocWardenVersion = "0.7.1", - + [string]$DocWardenVersion = "0.7.2", [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 (-not [System.String]::IsNullOrWhiteSpace($RepoRoot)) +{ + ward scan -d $ScanPath -u $RepoRoot -c $SettingsPath +} +else +{ + ward scan -d $ScanPath -c $SettingsPath +} +