From e7980d793574bdebef9ad439715c8b55fd18b24a Mon Sep 17 00:00:00 2001 From: sima-zhu Date: Wed, 13 Jul 2022 10:54:05 -0700 Subject: [PATCH] Fixed the metadata for better handling --- 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 d5cd1af642..ba6f32b7d7 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 0fc334dd6b..1bef012293 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 }