From 0408ac771e46981daa5353228e95e2af139c2c60 Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Fri, 22 Jul 2022 15:52:48 -0400 Subject: [PATCH 1/5] Detect API changes using new snadboxinx approach --- eng/common/scripts/Detect-Api-Changes.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eng/common/scripts/Detect-Api-Changes.ps1 b/eng/common/scripts/Detect-Api-Changes.ps1 index 1c9cdf696b..9c3eebbd9a 100644 --- a/eng/common/scripts/Detect-Api-Changes.ps1 +++ b/eng/common/scripts/Detect-Api-Changes.ps1 @@ -27,6 +27,7 @@ function Submit-Request($filePath, $packageName) if (!$repoName) { $repoName = "azure/azure-sdk-for-$LanguageShort" } + $reviewFileName = "$($packageName)_$($LanguageShort).json" $query = [System.Web.HttpUtility]::ParseQueryString('') $query.Add('artifactName', $ArtifactName) $query.Add('buildId', $BuildId) @@ -35,6 +36,12 @@ function Submit-Request($filePath, $packageName) $query.Add('repoName', $repoName) $query.Add('pullRequestNumber', $PullRequestNumber) $query.Add('packageName', $packageName) + $query.Add('language', $LanguageShort) + $reviewFileFullName = Join-Path -Path $ArtifactPath $packageName $reviewFileName + if (Test-Path $reviewFileFullName) + { + $query.Add('codeFile', $reviewFileName) + } $uri = [System.UriBuilder]$APIViewUri $uri.query = $query.toString() Write-Host "Request URI: $($uri.Uri.OriginalString)" From 495b650a29a5ffb8d063031525e55a3f5f24ee85 Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Fri, 22 Jul 2022 15:59:36 -0400 Subject: [PATCH 2/5] Added strictmode --- eng/common/scripts/Detect-Api-Changes.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/common/scripts/Detect-Api-Changes.ps1 b/eng/common/scripts/Detect-Api-Changes.ps1 index 9c3eebbd9a..ccb0a63817 100644 --- a/eng/common/scripts/Detect-Api-Changes.ps1 +++ b/eng/common/scripts/Detect-Api-Changes.ps1 @@ -18,6 +18,7 @@ Param ( [string] $TargetBranch = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/") ) +Set-StrictMode -version 3 . (Join-Path $PSScriptRoot common.ps1) # Submit API review request and return status whether current revision is approved or pending or failed to create review From c0480cae0a9508c6e633c989ef5af91b24b3c96a Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Mon, 25 Jul 2022 14:42:02 -0400 Subject: [PATCH 3/5] Remove unset variable --- eng/common/scripts/Detect-Api-Changes.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/common/scripts/Detect-Api-Changes.ps1 b/eng/common/scripts/Detect-Api-Changes.ps1 index ccb0a63817..9a09df8baa 100644 --- a/eng/common/scripts/Detect-Api-Changes.ps1 +++ b/eng/common/scripts/Detect-Api-Changes.ps1 @@ -88,7 +88,6 @@ function Log-Input-Params() Write-Host "Language: $($Language)" Write-Host "Commit SHA: $($CommitSha)" Write-Host "Repo Name: $($RepoFullName)" - Write-Host "Package Name: $($PackageName)" } Log-Input-Params From 86e0f1fac30390fe59a042d38852bbd296190fe1 Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Mon, 25 Jul 2022 15:37:08 -0400 Subject: [PATCH 4/5] Changes as per strict mode 3 --- eng/common/scripts/Detect-Api-Changes.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/Detect-Api-Changes.ps1 b/eng/common/scripts/Detect-Api-Changes.ps1 index 9a09df8baa..b5c8acc246 100644 --- a/eng/common/scripts/Detect-Api-Changes.ps1 +++ b/eng/common/scripts/Detect-Api-Changes.ps1 @@ -73,7 +73,7 @@ function Should-Process-Package($pkgPath, $packageName) # Get package info from json file created before updating version to daily dev $pkgInfo = Get-Content $pkgPropPath | ConvertFrom-Json $packagePath = $pkgInfo.DirectoryPath - $modifiedFiles = Get-ChangedFiles -DiffPath "$packagePath/*" -DiffFilterType '' + $modifiedFiles = @(Get-ChangedFiles -DiffPath "$packagePath/*" -DiffFilterType '') $filteredFileCount = $modifiedFiles.Count Write-Host "Number of modified files for package: $filteredFileCount" return ($filteredFileCount -gt 0 -and $pkgInfo.IsNewSdk) From 4cff06f84ed7d2486562008cd6d9e5f75246793f Mon Sep 17 00:00:00 2001 From: praveenkuttappan Date: Mon, 25 Jul 2022 16:12:01 -0400 Subject: [PATCH 5/5] Rervert strict mode to allow language level fixes to merge first --- eng/common/scripts/Detect-Api-Changes.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/common/scripts/Detect-Api-Changes.ps1 b/eng/common/scripts/Detect-Api-Changes.ps1 index b5c8acc246..572ef43e1c 100644 --- a/eng/common/scripts/Detect-Api-Changes.ps1 +++ b/eng/common/scripts/Detect-Api-Changes.ps1 @@ -18,7 +18,6 @@ Param ( [string] $TargetBranch = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/") ) -Set-StrictMode -version 3 . (Join-Path $PSScriptRoot common.ps1) # Submit API review request and return status whether current revision is approved or pending or failed to create review