Skip to content

Changelog tools #1961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Sep 17, 2019
Merged

Changelog tools #1961

merged 52 commits into from
Sep 17, 2019

Conversation

rjmholt
Copy link
Contributor

@rjmholt rjmholt commented May 13, 2019

Adds changelog generation tools to the repo.

The module has some slightly opinionated things about generating a changelog for any repo, and the script generates changelogs for PowerShellEditorServices and vscode-PowerShell and opens PRs for both of them.

All configurable with labelling etc.

}
}

filter GetHumanishRepositoryDetails
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL!

Copy link
Contributor Author

@rjmholt rjmholt May 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git seems to like using the ish suffix to refer to softened parameter "types", like commitish and humanish

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm familiar with "commitish" but not "humanish". Thx.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aggravatingly they use the terms in passing and you have to sift through StackOverflow to decode them

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff here!

@rjmholt rjmholt closed this May 20, 2019
@rjmholt rjmholt deleted the changelog-tools branch May 20, 2019 05:49
@rjmholt rjmholt restored the changelog-tools branch May 20, 2019 05:49
@TylerLeonhardt
Copy link
Member

Oh?

@rjmholt
Copy link
Contributor Author

rjmholt commented May 20, 2019

Ah that's because I accidentally deleted the branch!

@rjmholt rjmholt reopened this May 20, 2019
@rjmholt
Copy link
Contributor Author

rjmholt commented May 20, 2019

Ok here's the kinds of PR this opens:

A few notes:

  • This adds a little emoji based on the issue label, if there is one
  • The link is always to the PR, but if it closes an issue the issue is used as the name. When vscode-powershell issues are closed in PSES, it says [vscode-PowerShell #XXXX]
  • If there's no PR for a commit, there's no [...] at the start
  • This depends on the GitHub commit message format where it adds (#XXXX) to the end of commit messages
  • We can easily add more tags in various places:
    • PR labels like PowerShell's CL-Breaking tags
    • Issue labels, like the existing Issue-Bug, Issue-Enhancement
    • In commits with [tag] -- currently [Ignore] is registered

The changelog script also separates the changelog into sections if any PRs close categorised issues (e.g. Area-PSReadLine). Again we can easily add to this with PR labels too.

@rjmholt rjmholt force-pushed the changelog-tools branch from a1e5da1 to 16670e4 Compare May 20, 2019 16:17
@rjmholt rjmholt changed the title WIP: Changelog tools Changelog tools May 20, 2019
Get-ChangeInfoFromCommit -GitHubToken $GitHubToken |
Skip-IgnoredChange @ignore |
New-ChangelogEntry @clEntryParams |
New-ChangelogSection @clSectionParams -Preamble "#### [$psesRepoName](https://github.com/$Organization/$psesRepoName)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PSES does not have this Preamble

}
}

filter New-ChangelogEntry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how important making Codacy green is here, but could add something like: [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "", Justification="We're not actually changing system state.")] to suppress it complaining about failing the PSSA rule...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ironically there are much more dangerous methods in the GitHubTools.psm1 module that it misses. PSScriptAnalyzer has some weird bits in it frankly -- I'd love to make it more logical.


if ($CloneBranch)
{
Write-Verbose "Cloned branch: $CloneBranch"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be after the exec?

@@ -6,22 +6,55 @@
using module ..\GitHubTools.psm1
using module ..\ChangelogTools.psm1

<#
.EXAMPLE
.\updateChangelog.ps1 -GitHubToken $ghTok -PSExtensionSinceRef v2.0.0-preview.3 -PsesSinceRef v2.0.0-preview.3 -PSExtensionVersion 2019.5.0 -PsesVersion 1.12.2 -PSExtensionUntilRef legacy/1.x -PsesUntilRef legacy/1.x -Verbose
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by this example. You have a mix of preview and legacy?

RepositoryPath = $PsesRepositoryPath
Verbose = $VerbosePreference
}

$clEntryParams = @{
EntryCategories = $categories
DefaultCategory = $defaultCategory
TagLabels = @{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💙

$psesChangelogPostamble = ($psesChangelogSection -split "`n")
$psesChangelogPostamble = $psesChangelogPostamble[2..$psesChangelogPostamble.Length]
$psesChangelogPostamble = $psesChangelogSection -split "`n"
$psesChangelogPostamble = @("#### [$psesRepoName](https://github.com/$Organization/$psesRepoName)") + $psesChangelogPostamble[2..($psesChangelogPostamble.Length-3)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice if you added a small comment about these numbers ( 2 and 3)

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just a couple questions. Maybe do one test of this from a newly cloned PowerShell/vscode-powershell and PowerShell/PowerShellEditorServices

@TylerLeonhardt TylerLeonhardt merged commit 02236bd into PowerShell:master Sep 17, 2019
@rjmholt rjmholt deleted the changelog-tools branch December 11, 2019 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants