-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Update Get-ChangeLog to handle backport PRs correctly
#26610
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
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.
Pull request overview
This PR enhances the Get-ChangeLog function to correctly handle changelog generation for backport pull requests, which have different commit authors than the original PR authors. The implementation detects backport PRs by matching commit subject patterns, extracts the real author from the PR body using regex, and removes version prefix tags from commit messages for cleaner changelog entries.
Key changes:
- Introduces a new
$script:psteam_loginsarray to track PowerShell team member GitHub logins - Implements backport PR detection by matching
[release/vX.X]prefix in commit subjects - Moves the GitHub API call earlier in the processing loop to enable backport author extraction
- Updates the
Get-ChangeLogMessagefunction to strip release branch prefixes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
One more new scenario is Copilot's commits. |
| 'SeeminglyScience' | ||
| 'anamnavi' | ||
| 'sdwheeler' | ||
| 'Copilot' |
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.
Copilot is not the real author. He should have been replaced by the true initiator.
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.
We won't go that far. The initiator is not necessarily the one that drives it to the end, so it would be tricky to determine who should actually get the credit. Given that MS spends compute resources for a Copilot PR, we may just consider it MS' credit 😆
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.
I believe "Assignees" property of PR contains right value if remove Copilot. Is this the same that you do here for backport?
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.
No, for backport PRs, the description template has Triggered by @<user-doing-backport> on behalf of @<original-author>. This PR simply matches that pattern from the backport PR description to get the original author.
|
|
||
| # Ignore dependency bumping bot (Dependabot): | ||
| $Script:attribution_ignore_list = @( | ||
| 'dependabot[bot]@users.noreply.github.com' |
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.
The name dependabot[bot] is already included in powershell_team, so this check is no longer needed. Also, the email has now changed to <numbers>+dependabot[bot]@users.noreply.github.com.
PR Summary
This PR updates the
Get-ChangeLogfunction to properly handle commits from backport PRs, whose authors are different from the real author from the original PR.It now detects backport PRs by matching commit subjects and extracting the real author login from the PR body, ensuring correct attribution in the changelog. It also removes
[release/vX.X]prefixes from commit subject for cleaner changelog entries.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header