Skip to content

Commit

Permalink
Add parsing of changelog sections
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed May 29, 2021
1 parent d88e330 commit bef1cc7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion eng/common/scripts/ChangeLog-Operations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,35 @@ 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]@{
ReleaseVersion = $matches["version"]
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>.*)")
{
$changeLogEntry.ReleaseContent += $line
continue
}

switch ($matches["sectionName"])
{
"Features Added" { $changeLogEntry.FeaturesAdded += $line }
"Breaking Changes" { $changeLogEntry.BreakingChanges += $line }
"Key Bugs Fixed" { $changeLogEntry.KeyBugsFixed += $line }
"Fixed" { $changeLogEntry.Fixed += $line }
}
$changeLogEntry.ReleaseContent += $line
}
}
Expand Down

0 comments on commit bef1cc7

Please sign in to comment.