@@ -116,21 +116,19 @@ function Get-Bullets {
116116. DESCRIPTION
117117 This is used so that we can manually touch-up the automatically updated
118118 changelog, and then bring its contents into the extension's changelog or
119- the GitHub release.
119+ the GitHub release. It just gets the first header's contents.
120120#>
121- function Get-NewChangelog {
121+ function Get-FirstChangelog {
122122 param (
123123 [Parameter (Mandatory )]
124124 [ValidateSet ([RepoNames ])]
125125 [string ]$RepositoryName
126126 )
127- $Repo = Get-GitHubRepository - OwnerName PowerShell - RepositoryName $RepositoryName
128- $Release = $Repo | Get-GitHubRelease - Latest
129127 $Changelog = Get-Content - Path " $PSScriptRoot /../../$RepositoryName /$ChangelogFile "
130128 $Changelog.Where (
131129 { $_.StartsWith (" ##" ) }, " SkipUntil"
132130 ).Where (
133- { $_.StartsWith (" ## $ ( $Release .tag_name ) " ) }, " Until"
131+ { $_.StartsWith (" ##" ) }, " Until"
134132 )
135133}
136134
@@ -144,8 +142,8 @@ function Get-Version {
144142 [ValidateSet ([RepoNames ])]
145143 [string ]$RepositoryName
146144 )
147- # NOTE: This is joined into a multi- line string so `-match` works .
148- $Changelog = (Get-NewChangelog - RepositoryName $RepositoryName ) -join " `n "
145+ # NOTE: The first line should always be the header .
146+ $Changelog = (Get-FirstChangelog - RepositoryName $RepositoryName )[ 0 ]
149147 if ($Changelog -match ' ## v(?<version>\d+\.\d+\.\d+(-preview\.?\d*)?)' ) {
150148 return [semver ]$Matches.version
151149 } else {
@@ -169,6 +167,7 @@ function Update-Changelog {
169167 [ValidateSet ([RepoNames ])]
170168 [string ]$RepositoryName ,
171169
170+ # TODO: Validate version style for each repo.
172171 [Parameter (Mandatory )]
173172 [ValidateScript ({ $_.StartsWith (" v" ) })]
174173 [string ]$Version
@@ -178,15 +177,13 @@ function Update-Changelog {
178177
179178 # Get the repo object, latest release, and commits since its tag.
180179 $Repo = Get-GitHubRepository - OwnerName PowerShell - RepositoryName $RepositoryName
181- # TODO: Handle pre-releases (i.e. treat as latest).
182- $Release = $Repo | Get-GitHubRelease - Latest
183- $Commits = git rev- list " $ ( $Release.tag_name ) ..."
180+ $Commits = git rev- list " v$ ( Get-Version - RepositoryName $RepositoryName ) ..."
184181
185182 # NOTE: This is a slow API as it gets all PRs, and then filters.
186183 $Bullets = $Repo | Get-GitHubPullRequest - State All |
187184 Where-Object { $_.merge_commit_sha -in $Commits } |
188185 Where-Object { -not $_.user.UserName.EndsWith (" [bot]" ) } |
189- Where-Object { " Include " -notin $_.labels.LabelName } |
186+ Where-Object { " Ignore " -notin $_.labels.LabelName } |
190187 Where-Object { -not $_.title.StartsWith (" [Ignore]" ) } |
191188 Where-Object { -not $_.title.StartsWith (" Update CHANGELOG" ) } |
192189 Where-Object { -not $_.title.StartsWith (" Bump version" ) } |
@@ -201,7 +198,7 @@ function Update-Changelog {
201198 " "
202199 " #### [PowerShellEditorServices](https://github.com/PowerShell/PowerShellEditorServices)"
203200 " "
204- (Get-NewChangelog - RepositoryName " PowerShellEditorServices" ).Where ({ $_.StartsWith (" - " ) }, " SkipUntil" )
201+ (Get-FirstChangelog - RepositoryName " PowerShellEditorServices" ).Where ({ $_.StartsWith (" - " ) }, " SkipUntil" )
205202 )
206203 }
207204 " PowerShellEditorServices" {
@@ -334,7 +331,7 @@ function New-DraftRelease {
334331 [string ]$RepositoryName
335332 )
336333 $Version = Get-Version - RepositoryName $RepositoryName
337- $Changelog = (Get-NewChangelog - RepositoryName $RepositoryName ) -join " `n "
334+ $Changelog = (Get-FirstChangelog - RepositoryName $RepositoryName ) -join " `n "
338335 $ReleaseParams = @ {
339336 Draft = $true
340337 Tag = " v$Version "
0 commit comments