Skip to content

Commit

Permalink
Update go Language Settings and Detect-Api-Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Jan 29, 2025
1 parent 127671c commit 4461d43
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
15 changes: 8 additions & 7 deletions eng/common/scripts/Detect-Api-Changes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,32 +109,33 @@ $packageProperties = Get-ChildItem -Recurse -Force "$configFileDir" `
foreach ($packagePropFile in $packageProperties)
{
$packageMetadata = Get-Content $packagePropFile | ConvertFrom-Json
Write-Host "Processing $($packageMetadata.ArtifactName)"
$artifactOrModuleName = $packageMetadata.ArtifactName ?? $packageMetadata.ModuleName
Write-Host "Processing $($artifactOrModuleName)"

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

if ($packages)
{
$pkgPath = $packages.Values[0]
$isRequired = Should-Process-Package -pkgPath $pkgPath -packageName $($packageMetadata.ArtifactName)
$isRequired = Should-Process-Package -pkgPath $pkgPath -packageName $($artifactOrModuleName)
Write-Host "Is API change detect required for $($packages.ArtifactName):$($isRequired)"
if ($isRequired -eq $True)
{
$filePath = $pkgPath.Replace($ArtifactPath , "").Replace("\", "/")
$respCode = Submit-Request -filePath $filePath -packageName $($packageMetadata.ArtifactName)
$respCode = Submit-Request -filePath $filePath -packageName $($artifactOrModuleName)
if ($respCode -ne '200')
{
$responses[$($packageMetadata.ArtifactName)] = $respCode
$responses[$($artifactOrModuleName)] = $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 $($artifactOrModuleName)). 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 $($artifactOrModuleName)"
}
}

Expand Down
1 change: 1 addition & 0 deletions eng/common/scripts/Save-Package-Properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ foreach ($pkg in $allPackageProperties)
Write-Host "Package Version: $($pkg.Version)"
Write-Host "Package SDK Type: $($pkg.SdkType)"
Write-Host "Artifact Name: $($pkg.ArtifactName)"
Write-Host "Module Name: $($pkg.ModuleName)"
Write-Host "Release date: $($pkg.ReleaseStatus)"
$configFilePrefix = $pkg.Name

Expand Down
8 changes: 3 additions & 5 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,10 @@ function Get-AllPackageInfoFromRepo($serviceDirectory)
$searchPath = Join-Path $RepoRoot "sdk"
$pkgFiles = @()
if ($serviceDirectory) {
$searchPath = Join-Path $searchPath $serviceDirectory "go.mod"
[array]$pkgFiles = @(Get-ChildItem $searchPath)
} else {
# If service directory is not passed in, find all modules
[array]$pkgFiles = Get-ChildItem -Path $searchPath -Include "go.mod" -Recurse
$searchPath = Join-Path $searchPath $serviceDirectory
}

[array]$pkgFiles = Get-ChildItem -Path $searchPath -Include "go.mod" -Recurse

foreach ($pkgFile in $pkgFiles)
{
Expand Down

0 comments on commit 4461d43

Please sign in to comment.