Sync eng/common directory with azure-sdk-tools repository for Tools PR 999 (#661)

This commit is contained in:
Azure SDK Bot 2020-09-15 15:54:46 -07:00 committed by GitHub
parent 9d83f2c7bd
commit 7f2a11d9c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,12 +70,14 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){
}
$fileContent = $pkgInfo.ReadmeContent
$foundTitle = ""
# only replace the version if the formatted header can be found
$titleRegex = "(\# Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C))"
$fileContent = $pkgInfo.ReadmeContent -replace $titleRegex, "`${1} - Version $($pkgInfo.PackageVersion) `n"
$titleRegex = "(\#\s+(?<filetitle>Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C)))"
$foundTitle = ""
if ($fileContent -match $titleRegex) {
$fileContent = $fileContent -replace $titleRegex, "`${0} - Version $($pkgInfo.PackageVersion) `n"
$foundTitle = $matches["filetitle"]
}
# Replace github master link with release tag.
$ReplacementPattern = "`${1}$($pkgInfo.Tag)"
$fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern