From 5d276f1bd3d8e09f6aa0f1192433126e659e2a2d Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 8 Jun 2021 12:05:14 -0700 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 1633 (#22145) * Update format of new Changelog Entry * Add parsing of changelog sections * Update ChangeLog Logic Co-authored-by: Chidozie Ononiwu --- eng/common/scripts/ChangeLog-Operations.ps1 | 29 +++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 972e91616cd8f..98769dcd9eb09 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -40,7 +40,6 @@ function Get-ChangeLogEntriesFromContent { $changeLogEntries = [Ordered]@{} try { # walk the document, finding where the version specifiers are and creating lists - $changeLogEntry = $null foreach ($line in $changeLogContent) { if ($line -match $RELEASE_TITLE_REGEX) { $changeLogEntry = [pscustomobject]@{ @@ -48,11 +47,25 @@ function Get-ChangeLogEntriesFromContent { ReleaseStatus = $matches["releaseStatus"] ReleaseTitle = "## {0} {1}" -f $matches["version"], $matches["releaseStatus"] ReleaseContent = @() + Sections = @{} } $changeLogEntries[$changeLogEntry.ReleaseVersion] = $changeLogEntry } else { if ($changeLogEntry) { + if ($line.Trim() -match "^###\s(?.*)") + { + $sectionName = $matches["sectionName"].Trim() + $changeLogEntry.Sections[$sectionName] = @() + $changeLogEntry.ReleaseContent += $line + continue + } + + if ($sectionName) + { + $changeLogEntry.Sections[$sectionName] += $line + } + $changeLogEntry.ReleaseContent += $line } } @@ -195,7 +208,19 @@ function New-ChangeLogEntry { return $null } - if (!$Content) { $Content = @() } + if (!$Content) { + $Content = @() + $Content += "" + $Content += "### Features Added" + $Content += "" + $Content += "### Breaking Changes" + $Content += "" + $Content += "### Key Bugs Fixed" + $Content += "" + $Content += "### Fixed" + $Content += "" + $Content += "" + } $newChangeLogEntry = [pscustomobject]@{ ReleaseVersion = $Version