From 72c2985d0517459d050d7f50fe59cc72f3e85813 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 13 Jul 2022 15:02:29 -0700 Subject: [PATCH] Fixed the metadata for better handling (#22571) Co-authored-by: sima-zhu --- eng/common/scripts/Helpers/Metadata-Helpers.ps1 | 3 +-- .../scripts/Service-Level-Readme-Automation.ps1 | 16 ++++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/eng/common/scripts/Helpers/Metadata-Helpers.ps1 b/eng/common/scripts/Helpers/Metadata-Helpers.ps1 index d5cd1af642e1..ba6f32b7d725 100644 --- a/eng/common/scripts/Helpers/Metadata-Helpers.ps1 +++ b/eng/common/scripts/Helpers/Metadata-Helpers.ps1 @@ -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) { diff --git a/eng/common/scripts/Service-Level-Readme-Automation.ps1 b/eng/common/scripts/Service-Level-Readme-Automation.ps1 index 0fc334dd6bd6..1bef0122935b 100644 --- a/eng/common/scripts/Service-Level-Readme-Automation.ps1 +++ b/eng/common/scripts/Service-Level-Readme-Automation.ps1 @@ -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*(?(.*\n?)*?)---\n*(?(.*\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 ` @@ -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 }