Skip to content

Commit

Permalink
Use artifact path to find pregenerated token
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenkuttappan authored and azure-sdk committed Apr 2, 2024
1 parent 6a77eda commit 95b57f4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions eng/common/scripts/Create-APIReview.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ function Upload-ReviewTokenFile($packageName, $apiLabel, $releaseStatus, $review
return $StatusCode
}

function Get-APITokenFileName($packageName)
function Get-APITokenFileName($artifactName)
{
$reviewTokenFileName = "${packageName}_${LanguageShort}.json"
$tokenFilePath = Join-Path $ArtifactPath $packageName $reviewTokenFileName
$reviewTokenFileName = "${artifactName}_${LanguageShort}.json"
$tokenFilePath = Join-Path $ArtifactPath $artifactName $reviewTokenFileName
if (Test-Path $tokenFilePath) {
Write-Host "Review token file is present at $tokenFilePath"
return $reviewTokenFileName
Expand All @@ -139,14 +139,14 @@ function Get-APITokenFileName($packageName)
}
}

function Submit-APIReview($packageInfo, $packagePath)
function Submit-APIReview($packageInfo, $packagePath, $artifactName)
{
$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 $artifactName
if ($reviewTokenFileName) {
Write-Host "Uploading review token file $reviewTokenFileName to APIView."
return Upload-ReviewTokenFile $packageName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version $packagePath
Expand Down Expand Up @@ -209,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

0 comments on commit 95b57f4

Please sign in to comment.