Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 2685 (Azure#26877)
Browse files Browse the repository at this point in the history
* Fixed the no IsPrerelease property issue and retry 3 times on API call.

* check null

Co-authored-by: sima-zhu <[email protected]>
  • Loading branch information
azure-sdk and sima-zhu authored Feb 4, 2022
1 parent c5a055d commit c1d5637
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion eng/common/scripts/Helpers/Metadata-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function GetMsAliasFromGithub ($TenantId, $ClientId, $ClientSecret, $GithubUser)
$opsAuthToken = Generate-AadToken -TenantId $TenantId -ClientId $ClientId -ClientSecret $ClientSecret
$Headers["Authorization"] = "Bearer $opsAuthToken"
Write-Host "Fetching aad identity for github user: $GithubUser"
$resp = Invoke-RestMethod $OpensourceAPIBaseURI -Method 'GET' -Headers $Headers
$resp = Invoke-RestMethod $OpensourceAPIBaseURI -Method 'GET' -Headers $Headers -MaximumRetryCount 3
}
catch {
Write-Warning $_
Expand Down
10 changes: 4 additions & 6 deletions eng/common/scripts/Update-DocsMsMetadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,12 @@ function UpdateDocsMsMetadataForPackage($packageInfoJsonLocation, $packageInfo)
}

# Copy package info file to the docs repo
$docsMsMetadata = &$GetDocsMsMetadataForPackageFn $packageInfo
$readMePath = $docsMsMetadata.LatestReadMeLocation
$metadataMoniker = 'latest'
if ($originalVersion.IsPrerelease) {
if ($originalVersion -and $originalVersion.IsPrerelease) {
$metadataMoniker = 'preview'
$readMePath = $docsMsMetadata.PreviewReadMeLocation
}
$packageMetadataName = Split-Path $packageInfoJsonLocation -Leaf
$packageInfoLocation = Join-Path $DocRepoLocation "metadata/$metadataMoniker"
Expand All @@ -203,11 +206,6 @@ function UpdateDocsMsMetadataForPackage($packageInfoJsonLocation, $packageInfo)
if ($readmeContent) {
$outputReadmeContent = GetAdjustedReadmeContent $readmeContent $packageInfo $packageMetadata
}
$docsMsMetadata = &$GetDocsMsMetadataForPackageFn $packageInfo
$readMePath = $docsMsMetadata.LatestReadMeLocation
if ($originalVersion.IsPrerelease) {
$readMePath = $docsMsMetadata.PreviewReadMeLocation
}

$suffix = $docsMsMetadata.Suffix
$readMeName = "$($docsMsMetadata.DocsMsReadMeName.ToLower())-readme${suffix}.md"
Expand Down

0 comments on commit c1d5637

Please sign in to comment.