From 5d64d9109501eb3a834bde3bf89adcb68e3b8518 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Wed, 22 Aug 2018 17:32:32 -0700 Subject: [PATCH 1/2] Ignore commits for changelog starting with [ignore] --- tools/Get-PowerShellExtensionChangelog.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/Get-PowerShellExtensionChangelog.ps1 b/tools/Get-PowerShellExtensionChangelog.ps1 index 55993d92ab..45443bec5a 100644 --- a/tools/Get-PowerShellExtensionChangelog.ps1 +++ b/tools/Get-PowerShellExtensionChangelog.ps1 @@ -301,6 +301,11 @@ function Get-ChangeLog } foreach ($commit in $new_commits) { + if ($commit.Subject.StartsWith('[ignore]', [System.StringComparison]::OrdinalIgnoreCase)) + { + continue + } + $messageParts = Get-PRNumberFromCommitSubject $commit.Subject if ($messageParts) { From 29d453366f3f2b9fd78a7f99b8428427807b1f0e Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Wed, 22 Aug 2018 17:38:44 -0700 Subject: [PATCH 2/2] Change continue to prefilter --- tools/Get-PowerShellExtensionChangelog.ps1 | 27 +++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/tools/Get-PowerShellExtensionChangelog.ps1 b/tools/Get-PowerShellExtensionChangelog.ps1 index 45443bec5a..8f78b69449 100644 --- a/tools/Get-PowerShellExtensionChangelog.ps1 +++ b/tools/Get-PowerShellExtensionChangelog.ps1 @@ -300,35 +300,24 @@ function Get-ChangeLog $new_commits = $new_commits_during_last_release + $new_commits_after_last_release } - foreach ($commit in $new_commits) { - if ($commit.Subject.StartsWith('[ignore]', [System.StringComparison]::OrdinalIgnoreCase)) - { - continue - } + $new_commits = $new_commits | Where-Object { -not $_.Subject.StartsWith('[Ignore]', [System.StringComparison]::OrdinalIgnoreCase) } + foreach ($commit in $new_commits) { $messageParts = Get-PRNumberFromCommitSubject $commit.Subject - if ($messageParts) - { + if ($messageParts) { $message = $messageParts.Message $prNumber = $messageParts.PR - } - else - { + } else { $message = $commit.Subject } - if (-not ($commit.AuthorEmail.EndsWith("@microsoft.com") -or ($powershell_team -contains $commit.AuthorName) -or ($powershell_team_emails -contains $commit.AuthorEmail))) - { - if ($Script:community_login_map.ContainsKey($commit.AuthorEmail)) - { + if (-not ($commit.AuthorEmail.EndsWith("@microsoft.com") -or ($powershell_team -contains $commit.AuthorName) -or ($powershell_team_emails -contains $commit.AuthorEmail))) { + if ($Script:community_login_map.ContainsKey($commit.AuthorEmail)) { $commit.AuthorGitHubLogin = $Script:community_login_map[$commit.AuthorEmail] - } - else - { + } else { $uri = "$RepoUri/commits/$($commit.Hash)" $response = Invoke-WebRequest -Uri $uri -Method Get -Headers $header -ErrorAction SilentlyContinue - if($response) - { + if($response) { $content = ConvertFrom-Json -InputObject $response.Content $commit.AuthorGitHubLogin = $content.author.login $Script:community_login_map[$commit.AuthorEmail] = $commit.AuthorGitHubLogin