-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Automate the generation of release change log draft #5712
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
Conversation
tools/releaseTools.psm1
Outdated
| if ($commit.AuthorEmail.EndsWith("@microsoft.com")) { | ||
| $commit.ChangeLogMessage = "- {0}" -f $commit.Subject | ||
| } else { | ||
| $uri = "https://api.github.com/repos/PowerShell/PowerShell/commits/$($commit.Hash)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This belongs better in this module: https://github.com/PowerShell/PowerShellForGitHub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That module is more about generic GitHub operations, while this one is specific to powershell. It's based on how we operate the repository, for example
- we use squash merge almost all the time, so we can ignore merge commits when generating changelog.
- our release process, including how we do cherry-picks and merge release branch to master.
- the format of changelog entries, as well as the assumption that
[breaking change]tag will be put in commit description body by maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also optimize this by getting the author email address locally and only going to github if you don't know the login for that email.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. We don't have to query GitHub for every commit from external contributors, as they may be from the same one. Here is an example of output:
- Replace Remaining HttpBin.org Tests with WebListener (#5665) (Thanks @markekraus!)
- Combine Web Cmdlet Partial Class Files (#5612) (Thanks @markekraus!)
- Enable conversions from PSMethod to Delegate (#5287) (Thanks @powercode!)
- Fix PSVersion in PSSessionConfiguration tests (#5554) (Thanks @iSazonov!)
- Update target tag for master CI to 6.1.0-preview.1 (#5513)
- Remove AddTypeCommandBase class (#5407) (Thanks @iSazonov!)
We can save 2 queries in this example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added $community_login_map to cache the login names we queried.
tools/releaseTools.psm1
Outdated
| ############################## | ||
| #.SYNOPSIS | ||
| #In the release workflow, the release branch will be merged back to master after the release is done, | ||
| #and a merge commit will be greated as the child of the release tag commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo greated -> treated .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks!
|
We have three places where we mark a breaking change - PR description, PR label and now commit description. Can we reduce this amount? Can we use the Breaking change PR label in the script? |
TravisEz13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please file issues, respond to or add todo comments for comments
|
@iSazonov IMHO, it's useful to keep the "breaking change" information in the commit. It also would force maintainers to edit the commit descirption body with better messages before merging (I think this is particularly necessary for a breaking change commit). Today, we can easily find a commit whose body description is just a list of commit messages that are auto-generated by GitHub from the set of commits in the PR, including message entries like As for other places we mark for breaking change, they all have their purposes
|
|
@daxian-dbw Thanks for clarify. I agree that keeping the breaking change label in commit description is useful. Update: I see a community recommend to use git hooks: |
|
@iSazonov Thank you for the research! Let me play with the hook. |
|
@daxian-dbw If you plan to play with Git hooks please take attention on #3504 too. |
|
@iSazonov Will do, thanks! |
|
We should investigate what git hooks can do for us, but I cannot find any docs that GitHub supports these. I doubt that these would be supported as it would allow fairly arbitrary code to run on GitHub's servers. |
|
@TravisEz13 Good news (although preview only) https://developer.github.com/v3/enterprise-admin/pre_receive_hooks/ |
Create the module 'releaseTools.psm1' under 'tools' folder, which expose the function 'Get-ChangeLog' to generate a release change log based on the local commit history.
Create the module 'releaseTools.psm1' under 'tools' folder, which expose the function 'Get-ChangeLog' to generate a release change log based on the local commit history.
PR Summary
Automate the generation of release change log draft.
For a commit that is breaking change,
Get-ChangeLogassumes that a[breaking change]tag is put in the commit description body so that it can incorporate this information in the generated changelog entry.So to @PowerShell/powershell-maintainers, please put the
[breaking change]tag in the description body when you squash merge a PR that is a breaking change.PR Checklist
Note: Please mark anything not applicable to this PR
NA.[feature]if the change is significant or affectes feature testsWIP:to the beginning of the title and remove the prefix when the PR is ready.