-
Notifications
You must be signed in to change notification settings - Fork 505
Include revert PR instead of the reverted one in release notes #3974
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
Include revert PR instead of the reverted one in release notes #3974
Conversation
Hi @IrvingMg. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/cc @mimowo |
/ok-to-test |
@@ -1136,6 +1136,13 @@ func prsNumForCommitFromMessage(commitMessage string) (prs []int, err error) { | |||
prs = append(prs, pr) | |||
} | |||
|
|||
regex = regexp.MustCompile(`\(#(?P<number>\d+)\)\s*\n\nThis reverts 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.
This seems to anchor the message produced by the "git revert" command: https://github.com/git/git/blob/9d22ac51228304102deb62f30c3ecba6377e1237/sequencer.c#L2366
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.
Correct. I've added the \(#(?P<number>\d+)\)\s*\n\n
part so that we can retrieve the last PR number that appears in the commit message
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.
not new to this PR, but it would be helpful to use descriptive names (and comments!) instead of repeatedly using the regex
variable to do different unrelated things.
|
||
pr = prForRegex(regex, commitMessage) | ||
if pr != 0 { | ||
prs = append(prs, pr) |
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 is adding a new pr onto the list, and so it is not immediately clear to me, can you explain why this fixes the issue?
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.
If I understood correctly, the function prsNumForCommitFromMessage retrieves all the PR numbers included in the commit message. Then, later in the notesForCommit function, we iterate over the list of PRs until we find one with a valid release note. Once a valid note is found, we stop the iteration and ignore the remaining PRs.
Currently, revert commits—which contain multiple PR numbers in the message—are handled as regular squashed commits, and the PR number retrieved is the first one that appears. By adding this regex, we prepend the last PR number from the message to the PRs list. So if that PR has a release note, the notesForCommit function will retrieve it and stop, ignoring the rest.
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 see, thanks for the explanation.
LGTM |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: IrvingMg, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
As described in #3966, the release notes include the reverted PRs instead of the revert PRs.
Which issue(s) this PR fixes:
Fixes #3966
Special notes for your reviewer:
Does this PR introduce a user-facing change?