append the release note if there is no release note block - #803
Conversation
✅ Deploy Preview for k8s-prow ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pacoxu The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/assign @petr-muller @cblecker |
| // Splice in the contents of the new release note block to the top level comment. | ||
| // This accounts for all older regex matches. | ||
| b := []byte(ic.Issue.Body) | ||
| replaced := append(b[:i[2]], append([]byte("\r\n"+strings.TrimSpace(newNote)+"\r\n"), b[i[3]:]...)...) |
There was a problem hiding this comment.
The new append path above correctly detects \n vs \r\n and adapts, but this splice path still hardcodes \r\n. For a body using LF line endings (e.g., a PR created via API), this would inject CRLF around the note content, creating mixed line endings.
Since you've already written the detection logic, consider extracting the lineEnding variable before the if/else so both paths share it.
| fc.Issues[issueNum] = &github.Issue{Number: issueNum, User: github.User{Login: "user"}} | ||
| }, | ||
| expectedNote: "```release-note\nThe new note\n```\n", | ||
| }, |
There was a problem hiding this comment.
Both new test cases use LF-only bodies. Since GitHub's web UI typically produces CRLF bodies, consider adding a test with a CRLF body that has no existing release-note block (e.g., Body: "Top\r\nBelow") to exercise the strings.Contains(ic.Issue.Body, "\r\n") branch in the append path.
Here is an example: kubernetes/kubernetes#140600 (comment).
This PR help to support
/release-note-editon no release-note block PR description.