Skip to content

Commit d238273

Browse files
Verify API surface level against all approved revisions for GA releases (Azure#19959)
Co-authored-by: praveenkuttappan <[email protected]>
1 parent f4455f8 commit d238273

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

eng/common/scripts/Create-APIReview.ps1

Lines changed: 14 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)
18+
function Submit-APIReview($packagename, $filePath, $uri, $apiKey, $apiLabel, $releaseStatus)
1919
{
2020
$multipartContent = [System.Net.Http.MultipartFormDataContent]::new()
2121
$FileStream = [System.IO.FileStream]::new($filePath, [System.IO.FileMode]::Open)
@@ -33,6 +33,17 @@ function Submit-APIReview($packagename, $filePath, $uri, $apiKey, $apiLabel)
3333
$StringContent = [System.Net.Http.StringContent]::new($apiLabel)
3434
$StringContent.Headers.ContentDisposition = $stringHeader
3535
$multipartContent.Add($stringContent)
36+
Write-Host "Request param, label: $apiLabel"
37+
38+
if ($releaseStatus -and ($releaseStatus -ne "Unreleased"))
39+
{
40+
$compareAllParam = [System.Net.Http.Headers.ContentDispositionHeaderValue]::new("form-data")
41+
$compareAllParam.Name = "compareAllRevisions"
42+
$compareAllParamContent = [System.Net.Http.StringContent]::new($true)
43+
$compareAllParamContent.Headers.ContentDisposition = $compareAllParam
44+
$multipartContent.Add($compareAllParamContent)
45+
Write-Host "Request param, compareAllRevisions: true"
46+
}
3647

3748
$headers = @{
3849
"ApiKey" = $apiKey;
@@ -103,13 +114,14 @@ if ($packages)
103114

104115
Write-Host "Version: $($version)"
105116
Write-Host "SDK Type: $($pkgInfo.SdkType)"
117+
Write-Host "Release Status: $($pkgInfo.ReleaseStatus)"
106118

107119
# Run create review step only if build is triggered from main branch or if version is GA.
108120
# This is to avoid invalidating review status by a build triggered from feature branch
109121
if ( ($SourceBranch -eq $DefaultBranch) -or (-not $version.IsPrerelease))
110122
{
111123
Write-Host "Submitting API Review for package $($pkg)"
112-
$respCode = Submit-APIReview -packagename $pkg -filePath $pkgPath -uri $APIViewUri -apiKey $APIKey -apiLabel $APILabel
124+
$respCode = Submit-APIReview -packagename $pkg -filePath $pkgPath -uri $APIViewUri -apiKey $APIKey -apiLabel $APILabel -releaseStatus $pkgInfo.ReleaseStatus
113125
Write-Host "HTTP Response code: $($respCode)"
114126
# HTTP status 200 means API is in approved status
115127
if ($respCode -eq '200')

0 commit comments

Comments
 (0)