Skip to content

Commit c3e69f3

Browse files
committed
Update to open both changelogs
1 parent 3dffb37 commit c3e69f3

File tree

3 files changed

+161
-137
lines changed

3 files changed

+161
-137
lines changed

tools/ChangelogTools.psm1

Lines changed: 61 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class ChangeLog
5353

5454
filter Get-ChangeInfoFromCommit
5555
{
56+
[OutputType([ChangeInfo])]
5657
param(
5758
[Parameter(Mandatory, ValueFromPipeline, Position=0)]
5859
[GitHubCommitInfo[]]
@@ -99,6 +100,7 @@ filter Get-ChangeInfoFromCommit
99100

100101
filter New-ChangelogEntry
101102
{
103+
[OutputType([ChangelogEntry])]
102104
param(
103105
[Parameter(Mandatory, ValueFromPipeline)]
104106
[ChangeInfo]
@@ -109,7 +111,7 @@ filter New-ChangelogEntry
109111
$EntryCategories,
110112

111113
[Parameter(Mandatory)]
112-
[hashtable]
114+
[string]
113115
$DefaultCategory,
114116

115117
[Parameter(Mandatory)]
@@ -118,15 +120,7 @@ filter New-ChangelogEntry
118120

119121
[Parameter()]
120122
[string[]]
121-
$NoThanks = @(),
122-
123-
[Parameter()]
124-
[string]
125-
$Organization = 'PowerShell',
126-
127-
[Parameter()]
128-
[string]
129-
$Repository = 'vscode-powershell'
123+
$NoThanks = @()
130124
)
131125

132126
[string[]]$tags = @()
@@ -153,11 +147,14 @@ filter New-ChangelogEntry
153147

154148
if (-not $entryCategory)
155149
{
156-
$entryCategory = $DefaultCategory.Name
150+
$entryCategory = $DefaultCategory
157151
}
158152

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 }
161158
$thanks = if ($Change.ContributingUser -notin $NoThanks) { $Change.ContributingUser } else { $null }
162159

163160
$subject = $Change.Subject
@@ -173,68 +170,15 @@ filter New-ChangelogEntry
173170
Category = $entryCategory
174171
Tags = $tags
175172
Change = $Change
176-
RepositoryName = "$Organization/$Repository"
173+
RepositoryName = "$organization/$repository"
177174
BodyText = $Change.BodyText
178175
Subject = $subject
179176
}
180177
}
181178

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-
236179
function New-ChangeLogSection
237180
{
181+
[OutputType([string])]
238182
param(
239183
[Parameter(Mandatory, ValueFromPipeline)]
240184
[ChangelogEntry[]]
@@ -371,29 +315,65 @@ function New-ChangeLogSection
371315
}
372316
}
373317

374-
function New-ChangelogRelease
318+
filter Skip-IgnoredChange
375319
{
376320
param(
377-
[Parameter(Mandatory)]
378-
[string]
379-
$GitHubToken,
321+
[Parameter(Mandatory, ValueFromPipeline)]
322+
[ChangeInfo[]]
323+
$Change,
380324

381-
[Parameter(Mandatory)]
325+
[Parameter()]
382326
[string]
383-
$RepositoryPath,
327+
$User,
384328

385-
[Parameter(Mandatory)]
329+
[Parameter()]
386330
[string]
387-
$SinceRef,
331+
$CommitLabel,
388332

389333
[Parameter()]
390-
[string]
391-
$UntilRef = 'HEAD',
334+
[string[]]
335+
$IssueLabel,
392336

393337
[Parameter()]
394-
[IgnoreConfiguration]
395-
$Ignore
338+
[string[]]
339+
$PRLabel
396340
)
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+
}
397376
}
398377

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

tools/GitHubTools.psm1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ function Submit-GitChanges
369369

370370
function Get-GitCommit
371371
{
372+
[OutputType([GitHubCommitInfo])]
372373
[CmdletBinding(DefaultParameterSetName='SinceRef')]
373374
param(
374375
[Parameter(Mandatory, ParameterSetName='SinceRef')]

0 commit comments

Comments
 (0)