@@ -53,6 +53,7 @@ class ChangeLog
53
53
54
54
filter Get-ChangeInfoFromCommit
55
55
{
56
+ [OutputType ([ChangeInfo ])]
56
57
param (
57
58
[Parameter (Mandatory , ValueFromPipeline , Position = 0 )]
58
59
[GitHubCommitInfo []]
@@ -99,6 +100,7 @@ filter Get-ChangeInfoFromCommit
99
100
100
101
filter New-ChangelogEntry
101
102
{
103
+ [OutputType ([ChangelogEntry ])]
102
104
param (
103
105
[Parameter (Mandatory , ValueFromPipeline )]
104
106
[ChangeInfo ]
@@ -109,7 +111,7 @@ filter New-ChangelogEntry
109
111
$EntryCategories ,
110
112
111
113
[Parameter (Mandatory )]
112
- [hashtable ]
114
+ [string ]
113
115
$DefaultCategory ,
114
116
115
117
[Parameter (Mandatory )]
@@ -118,15 +120,7 @@ filter New-ChangelogEntry
118
120
119
121
[Parameter ()]
120
122
[string []]
121
- $NoThanks = @ (),
122
-
123
- [Parameter ()]
124
- [string ]
125
- $Organization = ' PowerShell' ,
126
-
127
- [Parameter ()]
128
- [string ]
129
- $Repository = ' vscode-powershell'
123
+ $NoThanks = @ ()
130
124
)
131
125
132
126
[string []]$tags = @ ()
@@ -153,11 +147,14 @@ filter New-ChangelogEntry
153
147
154
148
if (-not $entryCategory )
155
149
{
156
- $entryCategory = $DefaultCategory.Name
150
+ $entryCategory = $DefaultCategory
157
151
}
158
152
159
- $issueLink = if ($Change.IssueNumber -ge 0 ) { " https://github.com/$Organization /$Repository /issues/$ ( $Change.IssueNumber ) " } else { $null }
160
- $prLink = if ($Change.PRNumber -ge 0 ) { " https://github.com/$Organization /$Repository /$ ( $Change.PRNumber ) " } else { $null }
153
+ $organization = $Change.Commit.Organization
154
+ $repository = $Change.Commit.Repository
155
+
156
+ $issueLink = if ($Change.IssueNumber -ge 0 ) { $Change.ClosedIssues [0 ].GetHtmlUri() } else { $null }
157
+ $prLink = if ($Change.PRNumber -ge 0 ) { " https://github.com/$organization /$repository /$ ( $Change.PRNumber ) " } else { $null }
161
158
$thanks = if ($Change.ContributingUser -notin $NoThanks ) { $Change.ContributingUser } else { $null }
162
159
163
160
$subject = $Change.Subject
@@ -173,68 +170,15 @@ filter New-ChangelogEntry
173
170
Category = $entryCategory
174
171
Tags = $tags
175
172
Change = $Change
176
- RepositoryName = " $Organization / $Repository "
173
+ RepositoryName = " $organization / $repository "
177
174
BodyText = $Change.BodyText
178
175
Subject = $subject
179
176
}
180
177
}
181
178
182
- filter Skip-IgnoredChanges
183
- {
184
- param (
185
- [Parameter (Mandatory , ValueFromPipeline )]
186
- [ChangeInfo ]
187
- $Change ,
188
-
189
- [Parameter ()]
190
- [string []]
191
- $User ,
192
-
193
- [Parameter ()]
194
- [string []]
195
- $CommitLabel ,
196
-
197
- [Parameter ()]
198
- [string []]
199
- $IssueLabel ,
200
-
201
- [Parameter ()]
202
- [string []]
203
- $PRLabel
204
- )
205
-
206
- if ($Change.ContributingUser -in $User )
207
- {
208
- return
209
- }
210
-
211
- foreach ($changeCommitLabel in $Change.Commit.CommitLabels )
212
- {
213
- if ($changeCommitLabel -in $CommitLabel )
214
- {
215
- return
216
- }
217
- }
218
-
219
- foreach ($changeIssueLabel in $Change.Commit.IssueLabels )
220
- {
221
- if ($changeIssueLabel -in $IssueLabel )
222
- {
223
- return
224
- }
225
- }
226
-
227
- foreach ($changePRLabel in $Change.Commit.PRLabels )
228
- {
229
- if ()
230
- }
231
-
232
-
233
- return $Change
234
- }
235
-
236
179
function New-ChangeLogSection
237
180
{
181
+ [OutputType ([string ])]
238
182
param (
239
183
[Parameter (Mandatory , ValueFromPipeline )]
240
184
[ChangelogEntry []]
@@ -371,29 +315,65 @@ function New-ChangeLogSection
371
315
}
372
316
}
373
317
374
- function New-ChangelogRelease
318
+ filter Skip-IgnoredChange
375
319
{
376
320
param (
377
- [Parameter (Mandatory )]
378
- [string ]
379
- $GitHubToken ,
321
+ [Parameter (Mandatory , ValueFromPipeline )]
322
+ [ChangeInfo [] ]
323
+ $Change ,
380
324
381
- [Parameter (Mandatory )]
325
+ [Parameter ()]
382
326
[string ]
383
- $RepositoryPath ,
327
+ $User ,
384
328
385
- [Parameter (Mandatory )]
329
+ [Parameter ()]
386
330
[string ]
387
- $SinceRef ,
331
+ $CommitLabel ,
388
332
389
333
[Parameter ()]
390
- [string ]
391
- $UntilRef = ' HEAD ' ,
334
+ [string [] ]
335
+ $IssueLabel ,
392
336
393
337
[Parameter ()]
394
- [IgnoreConfiguration ]
395
- $Ignore
338
+ [string [] ]
339
+ $PRLabel
396
340
)
341
+
342
+ :outer foreach ($chg in $Change )
343
+ {
344
+ if ($chg.ContributingUser -in $User )
345
+ {
346
+ continue
347
+ }
348
+
349
+ foreach ($chgCommitLabel in $chg.Commit.CommitLabels )
350
+ {
351
+ if ($chgCommitLabel -in $CommitLabel )
352
+ {
353
+ continue :outer
354
+ }
355
+ }
356
+
357
+ foreach ($chgIssueLabel in $chg.ClosedIssues.Labels )
358
+ {
359
+ if ($chgIssueLabel -in $IssueLabel )
360
+ {
361
+ continue :outer
362
+ }
363
+ }
364
+
365
+ foreach ($chgPRLabel in $chg.PR.Labels )
366
+ {
367
+ if ($chgPRLabel -in $PRLabel )
368
+ {
369
+ continue :outer
370
+ }
371
+ }
372
+
373
+ # Yield the change
374
+ $chg
375
+ }
397
376
}
398
377
399
- Export-ModuleMember - Function Get-ChangeInfoFromCommit , New-ChangelogEntry , Skip-IgnoredChanges , New-ChangeLogSection
378
+
379
+ Export-ModuleMember - Function Get-ChangeInfoFromCommit , New-ChangelogEntry , New-ChangelogSection , Skip-IgnoredChange
0 commit comments