From c1c6ccc56a26037dde4080b0aad09d5ac101d1ca Mon Sep 17 00:00:00 2001
From: praveenkuttappan <prmarott@microsoft.com>
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 1c9cdf696bf..9c3eebbd9aa 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 aa25f5806c788cba2b22f45546b5f4655d99c54a Mon Sep 17 00:00:00 2001
From: praveenkuttappan <prmarott@microsoft.com>
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 9c3eebbd9aa..ccb0a638175 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 8a9c60c9d85a8b6702a94ef8b58d4981319e8d95 Mon Sep 17 00:00:00 2001
From: praveenkuttappan <prmarott@microsoft.com>
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 ccb0a638175..9a09df8baa2 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 3a3bd649cc498410418ff3d11f262c6746839d8d Mon Sep 17 00:00:00 2001
From: praveenkuttappan <prmarott@microsoft.com>
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 9a09df8baa2..b5c8acc2461 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 976d799a9007b550363d0885343a0e9b88586268 Mon Sep 17 00:00:00 2001
From: praveenkuttappan <prmarott@microsoft.com>
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 b5c8acc2461..572ef43e1cf 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