Skip to content

Commit

Permalink
Update common tool to support go (#9733)
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu authored Feb 4, 2025
1 parent 9520a09 commit 8877fe9
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions eng/common/scripts/Detect-Api-Changes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,37 +104,41 @@ if (!($FindArtifactForApiReviewFn -and (Test-Path "Function:$FindArtifactForApiR
$responses = @{}

$packageProperties = Get-ChildItem -Recurse -Force "$configFileDir" `
| Where-Object { $_.Extension -eq '.json' }
| Where-Object {
$_.Extension -eq '.json' -and ($_.FullName.Substring($configFileDir.Length + 1) -notmatch '^_.*?\\')
}

foreach ($packagePropFile in $packageProperties)
{
$packageMetadata = Get-Content $packagePropFile | ConvertFrom-Json
Write-Host "Processing $($packageMetadata.ArtifactName)"
$pkgArtifactName = $packageMetadata.ArtifactName ?? $packageMetadata.Name

Write-Host "Processing $($pkgArtifactName)"

$packages = &$FindArtifactForApiReviewFn $ArtifactPath $packageMetadata.ArtifactName
$packages = &$FindArtifactForApiReviewFn $ArtifactPath $pkgArtifactName

if ($packages)
{
$pkgPath = $packages.Values[0]
$isRequired = Should-Process-Package -pkgPath $pkgPath -packageName $($packageMetadata.ArtifactName)
Write-Host "Is API change detect required for $($packages.ArtifactName):$($isRequired)"
$isRequired = Should-Process-Package -pkgPath $pkgPath -packageName $pkgArtifactName
Write-Host "Is API change detect required for $($pkgArtifactName):$($isRequired)"
if ($isRequired -eq $True)
{
$filePath = $pkgPath.Replace($ArtifactPath , "").Replace("\", "/")
$respCode = Submit-Request -filePath $filePath -packageName $($packageMetadata.ArtifactName)
$respCode = Submit-Request -filePath $filePath -packageName $pkgArtifactName
if ($respCode -ne '200')
{
$responses[$($packageMetadata.ArtifactName)] = $respCode
$responses[$pkgArtifactName] = $respCode
}
}
else
{
Write-Host "Pull request does not have any change for $($packageMetadata.ArtifactName)). Skipping API change detect."
Write-Host "Pull request does not have any change for $($pkgArtifactName)). Skipping API change detect."
}
}
else
{
Write-Host "No package is found in artifact path to find API changes for $($packageMetadata.ArtifactName)"
Write-Host "No package is found in artifact path to find API changes for $($pkgArtifactName)"
}
}

Expand Down

0 comments on commit 8877fe9

Please sign in to comment.