azure-sdk-for-cpp/eng/common/scripts/Verify-ChangeLogs.ps1
Azure SDK Bot 8f6ea6b9b8
Sync eng/common directory with azure-sdk-tools for PR 9381 (#6239)
* change our verifyChangelogs over to utilizing the artifact details. if we don't have an artifact details at all, don't verify changelog. if we do, but skipverifychangelog is present, don't verify changelog. if we have artifact details, but no disable, verify the changelog

---------

Co-authored-by: Scott Beddall <scbedd@microsoft.com>
2024-11-18 15:13:17 -08:00

49 lines
1.1 KiB
PowerShell

# Wrapper Script for ChangeLog Verification in a PR
[CmdletBinding()]
param (
[String]$PackagePropertiesFolder
)
Set-StrictMode -Version 3
. (Join-Path $PSScriptRoot common.ps1)
function ShouldVerifyChangeLog ($PkgArtifactDetails) {
if ($PkgArtifactDetails) {
if ($PkgArtifactDetails.PSObject.Properties["skipVerifyChangeLog"] -eq $true) {
return $false
}
return $true
}
return $false
}
# find which packages we need to confirm the changelog for
$packageProperties = Get-ChildItem -Recurse "$PackagePropertiesFolder" *.json
# grab the json file, then confirm the changelog entry for it
$allPassing = $true
foreach($propertiesFile in $packageProperties) {
$PackageProp = Get-Content -Path $propertiesFile | ConvertFrom-Json
if (-not (ShouldVerifyChangeLog $PackageProp.ArtifactDetails)) {
Write-Host "Skipping changelog verification for $($PackageProp.Name)"
continue
}
$validChangeLog = Confirm-ChangeLogEntry -ChangeLogLocation $PackageProp.ChangeLogPath -VersionString $PackageProp.Version -ForRelease $false
if (-not $validChangeLog) {
$allPassing = $false
}
}
if (!$allPassing)
{
exit 1
}
exit 0