Clean-up changelog scripts (#2913)

Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
This commit is contained in:
Azure SDK Bot 2021-09-21 19:58:11 -07:00 committed by GitHub
parent 8727030623
commit b02dec3cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 64 deletions

View File

@ -1,61 +0,0 @@
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[DateTime] $FromDate
)
. (Join-Path $PSScriptRoot common.ps1)
$releaseHighlights = @{}
if ($FromDate -as [DateTime])
{
$date = ([DateTime]$FromDate).ToString($CHANGELOG_DATE_FORMAT)
}
else {
LogWarning "Invalid date passed. Switch to using the current date"
$date = Get-Date -Format $CHANGELOG_DATE_FORMAT
}
$allPackageProps = Get-AllPkgProperties
foreach ($packageProp in $allPackageProps) {
$changeLogLocation = $packageProp.ChangeLogPath
if (!(Test-Path $changeLogLocation))
{
continue
}
$changeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $changeLogLocation
$packageName = $packageProp.Name
$serviceDirectory = $packageProp.ServiceDirectory
$packageDirectoryname = Split-Path -Path $packageProp.DirectoryPath -Leaf
foreach ($changeLogEntry in $changeLogEntries.Values) {
if ([System.String]::IsNullOrEmpty($changeLogEntry.ReleaseStatus))
{
continue;
}
$ReleaseStatus = $changeLogEntry.ReleaseStatus.Trim("(",")")
if (!($ReleaseStatus -as [DateTime]) -or $ReleaseStatus -lt $date)
{
continue;
}
$releaseVersion = $changeLogEntry.ReleaseVersion
$githubAnchor = $changeLogEntry.ReleaseTitle.Replace("## ", "").Replace(".", "").Replace("(", "").Replace(")", "").Replace(" ", "-")
$releaseTag = "${packageName}_${releaseVersion}"
$key = "${packageName}:${releaseVersion}"
$releaseHighlights[$key] = @{}
$releaseHighlights[$key]["PackageProperties"] = $packageProp
$releaseHighlights[$key]["ChangelogUrl"] = "https://github.com/Azure/azure-sdk-for-${LanguageShort}/blob/${releaseTag}/sdk/${serviceDirectory}/${packageDirectoryname}/CHANGELOG.md#${githubAnchor}"
$releaseHighlights[$key]["Content"] = @()
$changeLogEntry.ReleaseContent | %{
$releaseHighlights[$key]["Content"] += $_.Replace("###", "####")
}
}
}
return $releaseHighlights

View File

@ -5,6 +5,7 @@
# Unreleased: Default is true. If it is set to false, then today's date will be set in verion title. If it is True then title will show "Unreleased"
# ReplaceLatestEntryTitle: Replaces the latest changelog entry title.
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[String]$Version,
@ -74,13 +75,13 @@ if ($ChangeLogEntries.Contains($Version))
{
if ($ChangeLogEntries[$Version].ReleaseStatus -eq $ReleaseStatus)
{
LogWarning "Version [$Version] is already present in change log with specificed ReleaseStatus [$ReleaseStatus]. No Change made."
LogDebug "Version [$Version] is already present in change log with specificed ReleaseStatus [$ReleaseStatus]. No Change made."
exit(0)
}
if ($Unreleased -and ($ChangeLogEntries[$Version].ReleaseStatus -ne $ReleaseStatus))
{
LogWarning "Version [$Version] is already present in change log with a release date. Please review [$ChangelogPath]. No Change made."
LogDebug "Version [$Version] is already present in change log with a release date. Please review [$ChangelogPath]. No Change made."
exit(0)
}
@ -88,7 +89,7 @@ if ($ChangeLogEntries.Contains($Version))
{
if ((Get-Date ($ChangeLogEntries[$Version].ReleaseStatus).Trim("()")) -gt (Get-Date $ReleaseStatus.Trim("()")))
{
LogWarning "New ReleaseDate for version [$Version] is older than existing release date in changelog. Please review [$ChangelogPath]. No Change made."
LogDebug "New ReleaseDate for version [$Version] is older than existing release date in changelog. Please review [$ChangelogPath]. No Change made."
exit(0)
}
}

View File

@ -1,4 +1,5 @@
# Wrapper Script for ChangeLog Verification
[CmdletBinding()]
param (
[String]$ChangeLogLocation,
[String]$VersionString,