Skip to content

Commit 9cfe00a

Browse files
APIView - send package version param for automatic API review request (#39197)
Co-authored-by: Praveen Kuttappan <[email protected]>
1 parent f8b369f commit 9cfe00a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

eng/common/scripts/Create-APIReview.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Param (
1515
)
1616

1717
# Submit API review request and return status whether current revision is approved or pending or failed to create review
18-
function Submit-APIReview($packagename, $filePath, $uri, $apiKey, $apiLabel, $releaseStatus)
18+
function Submit-APIReview($packagename, $filePath, $uri, $apiKey, $apiLabel, $releaseStatus, $packageVersion)
1919
{
2020
$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
2121
$FileStream = [System.IO.FileStream]::new($filePath, [System.IO.FileMode]::Open)
@@ -35,6 +35,13 @@ function Submit-APIReview($packagename, $filePath, $uri, $apiKey, $apiLabel, $re
3535
$multipartContent.Add($stringContent)
3636
Write-Host "Request param, label: $apiLabel"
3737

38+
$versionParam = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
39+
$versionParam.Name = "packageVersion"
40+
$versionContent = [System.Net.Http.StringContent]::new($packageVersion)
41+
$versionContent.Headers.ContentDisposition = $versionParam
42+
$multipartContent.Add($versionContent)
43+
Write-Host "Request param, packageVersion: $packageVersion"
44+
3845
if ($releaseStatus -and ($releaseStatus -ne "Unreleased"))
3946
{
4047
$compareAllParam = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
@@ -106,6 +113,7 @@ if ($packages)
106113
# Get package info from json file created before updating version to daily dev
107114
$pkgInfo = Get-Content $pkgPropPath | ConvertFrom-Json
108115
$version = [AzureEngSemanticVersion]::ParseVersionString($pkgInfo.Version)
116+
$versionString = $pkgInfo.Version
109117
if ($version -eq $null)
110118
{
111119
Write-Host "Version info is not available for package $PackageName, because version '$(pkgInfo.Version)' is invalid. Please check if the version follows Azure SDK package versioning guidelines."
@@ -121,7 +129,7 @@ if ($packages)
121129
if ( ($SourceBranch -eq $DefaultBranch) -or (-not $version.IsPrerelease))
122130
{
123131
Write-Host "Submitting API Review for package $($pkg)"
124-
$respCode = Submit-APIReview -packagename $pkg -filePath $pkgPath -uri $APIViewUri -apiKey $APIKey -apiLabel $APILabel -releaseStatus $pkgInfo.ReleaseStatus
132+
$respCode = Submit-APIReview -packagename $pkg -filePath $pkgPath -uri $APIViewUri -apiKey $APIKey -apiLabel $APILabel -releaseStatus $pkgInfo.ReleaseStatus -packageVersion $versionString
125133
Write-Host "HTTP Response code: $($respCode)"
126134
# HTTP status 200 means API is in approved status
127135
if ($respCode -eq '200')

0 commit comments

Comments
 (0)