mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix Changelog content grab during GitHub Release (#24788)
Co-authored-by: Justin Chung <chungjustin@microsoft.com>
This commit is contained in:
co-authored by
Justin Chung
parent
b714f63268
commit
cb9e8a9935
@@ -75,14 +75,12 @@ jobs:
|
||||
|
||||
$changelog = Get-Content -Path $filePath
|
||||
|
||||
$startPattern = "^## \[" + ([regex]::Escape($releaseVersion)) + "\]"
|
||||
$endPattern = "^## \[{0}\.{1}\.{2}*" -f $semanticVersion.Major, $semanticVersion.Minor, $semanticVersion.Patch
|
||||
$headingPattern = "^## \[\d+\.\d+\.\d+"
|
||||
$headingStartLines = $changelog | Select-String -Pattern $headingPattern | Select-Object -ExpandProperty LineNumber
|
||||
$startLine = $headingStartLines[0]
|
||||
$endLine = $headingStartLines[1] - 1
|
||||
|
||||
$clContent = $changelog | ForEach-Object {
|
||||
if ($_ -match $startPattern) { $outputLine = $true }
|
||||
elseif ($_ -match $endPattern) { $outputLine = $false }
|
||||
if ($outputLine) { $_}
|
||||
} | Out-String
|
||||
$clContent = $changelog | Select-Object -Skip ($startLine-1) -First ($endLine - $startLine) | Out-String
|
||||
|
||||
Write-Verbose -Verbose "Selected content: `n$clContent"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user