@@ -116,21 +116,19 @@ function Get-Bullets {
116
116
. DESCRIPTION
117
117
This is used so that we can manually touch-up the automatically updated
118
118
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.
120
120
#>
121
- function Get-NewChangelog {
121
+ function Get-FirstChangelog {
122
122
param (
123
123
[Parameter (Mandatory )]
124
124
[ValidateSet ([RepoNames ])]
125
125
[string ]$RepositoryName
126
126
)
127
- $Repo = Get-GitHubRepository - OwnerName PowerShell - RepositoryName $RepositoryName
128
- $Release = $Repo | Get-GitHubRelease - Latest
129
127
$Changelog = Get-Content - Path " $PSScriptRoot /../../$RepositoryName /$ChangelogFile "
130
128
$Changelog.Where (
131
129
{ $_.StartsWith (" ##" ) }, " SkipUntil"
132
130
).Where (
133
- { $_.StartsWith (" ## $ ( $Release .tag_name ) " ) }, " Until"
131
+ { $_.StartsWith (" ##" ) }, " Until"
134
132
)
135
133
}
136
134
@@ -144,8 +142,8 @@ function Get-Version {
144
142
[ValidateSet ([RepoNames ])]
145
143
[string ]$RepositoryName
146
144
)
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 ]
149
147
if ($Changelog -match ' ## v(?<version>\d+\.\d+\.\d+(-preview\.?\d*)?)' ) {
150
148
return [semver ]$Matches.version
151
149
} else {
@@ -169,6 +167,7 @@ function Update-Changelog {
169
167
[ValidateSet ([RepoNames ])]
170
168
[string ]$RepositoryName ,
171
169
170
+ # TODO: Validate version style for each repo.
172
171
[Parameter (Mandatory )]
173
172
[ValidateScript ({ $_.StartsWith (" v" ) })]
174
173
[string ]$Version
@@ -178,15 +177,13 @@ function Update-Changelog {
178
177
179
178
# Get the repo object, latest release, and commits since its tag.
180
179
$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 ) ..."
184
181
185
182
# NOTE: This is a slow API as it gets all PRs, and then filters.
186
183
$Bullets = $Repo | Get-GitHubPullRequest - State All |
187
184
Where-Object { $_.merge_commit_sha -in $Commits } |
188
185
Where-Object { -not $_.user.UserName.EndsWith (" [bot]" ) } |
189
- Where-Object { " Include " -notin $_.labels.LabelName } |
186
+ Where-Object { " Ignore " -notin $_.labels.LabelName } |
190
187
Where-Object { -not $_.title.StartsWith (" [Ignore]" ) } |
191
188
Where-Object { -not $_.title.StartsWith (" Update CHANGELOG" ) } |
192
189
Where-Object { -not $_.title.StartsWith (" Bump version" ) } |
@@ -201,7 +198,7 @@ function Update-Changelog {
201
198
" "
202
199
" #### [PowerShellEditorServices](https://github.com/PowerShell/PowerShellEditorServices)"
203
200
" "
204
- (Get-NewChangelog - RepositoryName " PowerShellEditorServices" ).Where ({ $_.StartsWith (" - " ) }, " SkipUntil" )
201
+ (Get-FirstChangelog - RepositoryName " PowerShellEditorServices" ).Where ({ $_.StartsWith (" - " ) }, " SkipUntil" )
205
202
)
206
203
}
207
204
" PowerShellEditorServices" {
@@ -334,7 +331,7 @@ function New-DraftRelease {
334
331
[string ]$RepositoryName
335
332
)
336
333
$Version = Get-Version - RepositoryName $RepositoryName
337
- $Changelog = (Get-NewChangelog - RepositoryName $RepositoryName ) -join " `n "
334
+ $Changelog = (Get-FirstChangelog - RepositoryName $RepositoryName ) -join " `n "
338
335
$ReleaseParams = @ {
339
336
Draft = $true
340
337
Tag = " v$Version "
0 commit comments