[release/v7.6] Update Get-ChangeLog to handle backport PRs correctly#26706
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request backports changelog generation improvements from the main branch to release/v7.6. The changes enhance the Get-ChangeLog function to properly handle backport PRs by extracting the original author from the PR description, ensuring accurate attribution in changelogs.
Changes:
- Added new PowerShell team member GitHub logins list for author attribution
- Enhanced backport PR detection and real author extraction from PR body
- Improved API error handling with proper status code checks
- Fixed variable naming issue (
$input→$value) to avoid PowerShell automatic variable conflicts - Removed deprecated attribution ignore list in favor of new team logins approach
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
|
|
||
| if ($commitSubject -match '^\[release/v\d\.\d\] ') { |
There was a problem hiding this comment.
The regex pattern '^\[release/v\d\.\d\] ' only matches single-digit version numbers. This will fail for future versions like [release/v10.0] or patch versions like [release/v7.10]. The pattern should be '^\[release/v\d+\.\d+\] ' to match one or more digits in each version component, consistent with the pattern used in the Invoke-PRBackport function on line 903.
| if ($commitSubject -match '^\[release/v\d\.\d\] ') { | |
| if ($commitSubject -match '^\[release/v\d+\.\d+\] ') { |
| '^Build\(deps\): ' { | ||
| return $OriginalMessage.replace($Matches.0,'') | ||
| } | ||
| '^\[release/v\d\.\d\] ' { |
There was a problem hiding this comment.
The regex pattern '^\[release/v\d\.\d\] ' only matches single-digit version numbers. This should be '^\[release/v\d+\.\d+\] ' to match one or more digits in each version component, ensuring consistency with line 301 and supporting future versions like v10.x or v7.10.
| '^\[release/v\d\.\d\] ' { | |
| '^\[release/v\d+\.\d+\] ' { |
| $commit.ChangeLogMessage = ("- {0} (Thanks @{1}!)" -f (Get-ChangeLogMessage $commitSubject), $commit.AuthorGitHubLogin) | ||
| $commit.ThankYouMessage = ("@{0}" -f ($commit.AuthorGitHubLogin)) |
There was a problem hiding this comment.
If the GitHub API call fails or returns no response (lines 329-342), $commit.AuthorGitHubLogin may be null or empty. Line 351 then creates a changelog message with (Thanks @!) which is invalid. Consider adding a check to ensure $commit.AuthorGitHubLogin has a valid value before using it in the message, or provide a fallback when the GitHub login cannot be determined.
| $commit.ChangeLogMessage = ("- {0} (Thanks @{1}!)" -f (Get-ChangeLogMessage $commitSubject), $commit.AuthorGitHubLogin) | |
| $commit.ThankYouMessage = ("@{0}" -f ($commit.AuthorGitHubLogin)) | |
| if (-not [string]::IsNullOrWhiteSpace($commit.AuthorGitHubLogin)) { | |
| $commit.ChangeLogMessage = ("- {0} (Thanks @{1}!)" -f (Get-ChangeLogMessage $commitSubject), $commit.AuthorGitHubLogin) | |
| $commit.ThankYouMessage = ("@{0}" -f ($commit.AuthorGitHubLogin)) | |
| } else { | |
| $commit.ChangeLogMessage = "- {0}" -f (Get-ChangeLogMessage $commitSubject) | |
| } |
Backport of #26610 to release/v7.6
Triggered by @daxian-dbw on behalf of @daxian-dbw
Original CL Label: CL-BuildPackaging
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Customer Impact
Tooling improvement for changelog generation. The Get-ChangeLog function now correctly handles backport PRs by extracting the real author from the PR body, ensuring proper attribution in changelogs.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
The fix has been tested in the original PR. The changes can be verified by running Get-ChangeLog on a release branch that contains backport PRs and confirming that the changelog correctly attributes the commits to the original authors rather than the backport PR creators.
Risk
REQUIRED: Check exactly one box.
The changes only affect the changelog generation script used during the release process. It improves attribution accuracy for backport PRs by detecting them and extracting the real author from the PR body. This is tooling-only code that does not affect the product itself.