Skip to content

Commit

Permalink
Fixed the metadata for better handling (Azure#22571)
Browse files Browse the repository at this point in the history
Co-authored-by: sima-zhu <[email protected]>
  • Loading branch information
azure-sdk and sima-zhu authored Jul 13, 2022
1 parent 92ea6f2 commit 72c2985
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
3 changes: 1 addition & 2 deletions eng/common/scripts/Helpers/Metadata-Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ function GenerateDocsMsMetadata($originalMetadata, $language, $languageDisplayNa
"ms.service"= $msService
}
$updatedMetadata = compare-and-merge-metadata -original $originalMetadata -updated $metadataTable
return "---
$updatedMetadata---`r`n"
return "---`r`n$updatedMetadata---`r`n"
}

function ServiceLevelReadmeNameStyle($serviceName) {
Expand Down
16 changes: 6 additions & 10 deletions eng/common/scripts/Service-Level-Readme-Automation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,12 @@ function update-metadata-table($readmeFolder, $readmeName, $serviceName, $msServ
$readmePath = Join-Path $readmeFolder -ChildPath $readmeName
$readmeContent = Get-Content -Path $readmePath -Raw
$match = $readmeContent -match "^---\n*(?<metadata>(.*\n?)*?)---\n*(?<content>(.*\n?)*)"
if (!$match) {
# $Language, $LanguageDisplayName are the variables globally defined in Language-Settings.ps1
$metadataString = GenerateDocsMsMetadata -language $Language -languageDisplayName $LanguageDisplayName -serviceName $serviceName `
-tenantId $TenantId -clientId $ClientId -clientSecret $ClientSecret `
-msService $msService
Set-Content -Path $readmePath -Value "$metadataString$readmeContent" -NoNewline
return
$restContent = $readmeContent
$metadata = ""
if ($match) {
$restContent = $Matches["content"].trim()
$metadata = $Matches["metadata"].trim()
}
$restContent = $Matches["content"].trim()
$metadata = $Matches["metadata"].trim()
# $Language, $LanguageDisplayName are the variables globally defined in Language-Settings.ps1
$metadataString = GenerateDocsMsMetadata -originalMetadata $metadata -language $Language -languageDisplayName $LanguageDisplayName -serviceName $serviceName `
-tenantId $TenantId -clientId $ClientId -clientSecret $ClientSecret `
Expand All @@ -98,7 +94,7 @@ function generate-markdown-table($readmeFolder, $readmeName, $packageInfo, $moni
$tableContent = ""
# Here is the table, the versioned value will
foreach ($pkg in $packageInfo) {
$repositoryLink = "$RepositoryUri/$($pkg.Package)"
$repositoryLink = "$PackageRepositoryUri/$($pkg.Package)"
if (Test-Path "Function:$GetRepositoryLinkFn") {
$repositoryLink = &$GetRepositoryLinkFn -packageInfo $pkg
}
Expand Down

0 comments on commit 72c2985

Please sign in to comment.