Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions eng/common/scripts/Create-APIReview.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ function Upload-SourceArtifact($filePath, $apiLabel, $releaseStatus, $packageVer
return $StatusCode
}

function Upload-ReviewTokenFile($packageName, $apiLabel, $releaseStatus, $reviewFileName, $packageVersion)
function Upload-ReviewTokenFile($packageName, $apiLabel, $releaseStatus, $reviewFileName, $packageVersion, $filePath)
{
$params = "buildId=${BuildId}&artifactName=${ArtifactName}&originalFilePath=${packageName}&reviewFilePath=${reviewFileName}"
Write-Host "Original File path: $filePath"
$fileName = Split-Path -Leaf $filePath
Write-Host "OriginalFile name: $fileName"

$params = "buildId=${BuildId}&artifactName=${ArtifactName}&originalFilePath=${fileName}&reviewFilePath=${reviewFileName}"
$params += "&label=${apiLabel}&repoName=${RepoName}&packageName=${packageName}&project=internal&packageVersion=${packageVersion}"
if($MarkPackageAsShipped) {
$params += "&setReleaseTag=true"
Expand Down Expand Up @@ -135,17 +139,17 @@ function Get-APITokenFileName($packageName)
}
}

function Submit-APIReview($packageInfo, $packagePath)
function Submit-APIReview($packageInfo, $packagePath, $packageArtifactName)
{
$packageName = $packageInfo.Name
$apiLabel = "Source Branch:${SourceBranch}"

# Get generated review token file if present
# APIView processes request using different API if token file is already generated
$reviewTokenFileName = Get-APITokenFileName $packageName
$reviewTokenFileName = Get-APITokenFileName $packageArtifactName
if ($reviewTokenFileName) {
Write-Host "Uploading review token file $reviewTokenFileName to APIView."
return Upload-ReviewTokenFile $packageName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version
return Upload-ReviewTokenFile $packageName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version $packagePath
}
else {
Write-Host "Uploading $packagePath to APIView."
Expand Down Expand Up @@ -205,7 +209,7 @@ function ProcessPackage($packageName)
if ( ($SourceBranch -eq $DefaultBranch) -or (-not $version.IsPrerelease) -or $MarkPackageAsShipped)
{
Write-Host "Submitting API Review request for package $($pkg), File path: $($pkgPath)"
$respCode = Submit-APIReview $pkgInfo $pkgPath
$respCode = Submit-APIReview $pkgInfo $pkgPath $packageName
Write-Host "HTTP Response code: $($respCode)"

# no need to check API review status when marking a package as shipped
Expand Down