Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 9381 #1955

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions eng/common/scripts/Verify-ChangeLogs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,17 @@ Set-StrictMode -Version 3

. (Join-Path $PSScriptRoot common.ps1)

function ShouldVerifyChangeLog ($ServiceDirectory, $PackageName) {
$jsonCiYmlPath = Join-Path $ServiceDirectory "ci.yml"

if (Test-Path $jsonCiYmlPath)
{
$ciYml = Get-Content $jsonCiYmlPath -Raw | yq -o=json | ConvertFrom-Json -AsHashTable

if ($ciYml.extends -and $ciYml.extends.parameters -and $ciYml.extends.parameters.Artifacts) {
$packagesCheckingChangeLog = $ciYml.extends.parameters.Artifacts `
| Where-Object { -not ($_["skipVerifyChangelog"] -eq $true) } `
| Select-Object -ExpandProperty name
if ($packagesCheckingChangeLog -contains $PackageName)
{
return $true
} else {
return $false
}
}

function ShouldVerifyChangeLog ($PkgArtifactDetails) {
if ($PkgArtifactDetails) {
if ($PkgArtifactDetails.PSObject.Properties["skipVerifyChangeLog"] -eq $true) {
return $false
}
}

if (-not (Get-Command 'yq' -ErrorAction SilentlyContinue)) {
Write-Host "Error: 'yq' is not installed or not found in PATH. Please remedy this before running this script."
exit 1
return $true
}

return $false
}

# find which packages we need to confirm the changelog for
Expand All @@ -41,7 +28,7 @@ $allPassing = $true
foreach($propertiesFile in $packageProperties) {
$PackageProp = Get-Content -Path $propertiesFile | ConvertFrom-Json

if (-not (ShouldVerifyChangeLog -ServiceDirectory (Join-Path $RepoRoot "sdk" $PackageProp.ServiceDirectory) -PackageName $PackageProp.Name)) {
if (-not (ShouldVerifyChangeLog $PackageProp.ArtifactDetails)) {
Write-Host "Skipping changelog verification for $($PackageProp.Name)"
continue
}
Expand Down