From 8f9a9a5b5411359248e0141680995737ff79e824 Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Tue, 25 May 2021 13:30:36 -0700 Subject: [PATCH 1/3] Update format of new Changelog Entry --- eng/common/scripts/ChangeLog-Operations.ps1 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 972e91616c..f973e6dccc 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -195,7 +195,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 From 7cddad9c92e7306c24084002e200f82d6b3e951b Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Fri, 28 May 2021 18:36:06 -0700 Subject: [PATCH 2/3] Add parsing of changelog sections --- eng/common/scripts/ChangeLog-Operations.ps1 | 27 +++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index f973e6dccc..32851d115b 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,20 +47,38 @@ function Get-ChangeLogEntriesFromContent { ReleaseStatus = $matches["releaseStatus"] ReleaseTitle = "## {0} {1}" -f $matches["version"], $matches["releaseStatus"] ReleaseContent = @() + FeaturesAdded = @() + BreakingChanges = @() + KeyBugsFixed = @() + Fixed = @() } $changeLogEntries[$changeLogEntry.ReleaseVersion] = $changeLogEntry } else { if ($changeLogEntry) { + if ($line.Trim() -match "###\s(?.*)") + { + $sectionName = $matches["sectionName"] + $changeLogEntry.ReleaseContent += $line + continue + } + + if (-not [System.String]::IsNullOrEmpty($line)) + { + switch ($sectionName) + { + "Features Added" { $changeLogEntry.FeaturesAdded += $line } + "Breaking Changes" { $changeLogEntry.BreakingChanges += $line } + "Key Bugs Fixed" { $changeLogEntry.KeyBugsFixed += $line } + "Fixed" { $changeLogEntry.Fixed += $line } + } + } + $changeLogEntry.ReleaseContent += $line } } } } - catch { - Write-Host "Error parsing Changelog." - Write-Host $_.Exception.Message - } return $changeLogEntries } From 22b9e22e38b761ab22320686c1599032f66d156f Mon Sep 17 00:00:00 2001 From: Chidozie Ononiwu Date: Fri, 4 Jun 2021 15:12:13 -0700 Subject: [PATCH 3/3] Update ChangeLog Logic --- eng/common/scripts/ChangeLog-Operations.ps1 | 24 +++++++++------------ 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/eng/common/scripts/ChangeLog-Operations.ps1 b/eng/common/scripts/ChangeLog-Operations.ps1 index 32851d115b..98769dcd9e 100644 --- a/eng/common/scripts/ChangeLog-Operations.ps1 +++ b/eng/common/scripts/ChangeLog-Operations.ps1 @@ -47,31 +47,23 @@ function Get-ChangeLogEntriesFromContent { ReleaseStatus = $matches["releaseStatus"] ReleaseTitle = "## {0} {1}" -f $matches["version"], $matches["releaseStatus"] ReleaseContent = @() - FeaturesAdded = @() - BreakingChanges = @() - KeyBugsFixed = @() - Fixed = @() + Sections = @{} } $changeLogEntries[$changeLogEntry.ReleaseVersion] = $changeLogEntry } else { if ($changeLogEntry) { - if ($line.Trim() -match "###\s(?.*)") + if ($line.Trim() -match "^###\s(?.*)") { - $sectionName = $matches["sectionName"] + $sectionName = $matches["sectionName"].Trim() + $changeLogEntry.Sections[$sectionName] = @() $changeLogEntry.ReleaseContent += $line continue } - if (-not [System.String]::IsNullOrEmpty($line)) + if ($sectionName) { - switch ($sectionName) - { - "Features Added" { $changeLogEntry.FeaturesAdded += $line } - "Breaking Changes" { $changeLogEntry.BreakingChanges += $line } - "Key Bugs Fixed" { $changeLogEntry.KeyBugsFixed += $line } - "Fixed" { $changeLogEntry.Fixed += $line } - } + $changeLogEntry.Sections[$sectionName] += $line } $changeLogEntry.ReleaseContent += $line @@ -79,6 +71,10 @@ function Get-ChangeLogEntriesFromContent { } } } + catch { + Write-Host "Error parsing Changelog." + Write-Host $_.Exception.Message + } return $changeLogEntries }