From 9fb1591ca2008ee90d76d1fec1a98c0c4b75dfaa Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Thu, 2 Jan 2025 15:30:33 +0800 Subject: [PATCH] chore: Tweak APPROVALNOTIFIER markdown template to render consistent HTML Currently the rendered HTML on gitlab is confusing: ``` This pull-request has been approved by: To complete the pull request process, please assign You can assign the PR to them by writing /lh-assign @ in a comment when ready. ``` The above content are in one paragraph without new lines or `.`. Tweak according to [CommonMark Spec][1], since both [GitHub Flavored Markdown Spec][2] and [GitLab Flavored Markdown][3] are based on it. This also add a missing newline before `To complete ...`, so it will take it's own paragraph. [1]: https://spec.commonmark.org/0.31.2/#hard-line-breaks [2]: https://github.github.com/gfm/#hard-line-breaks [3]: https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/user/markdown.md#newlines --- pkg/plugins/approve/approvers/owners.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/plugins/approve/approvers/owners.go b/pkg/plugins/approve/approvers/owners.go index c259f272f..fdf670d2b 100644 --- a/pkg/plugins/approve/approvers/owners.go +++ b/pkg/plugins/approve/approvers/owners.go @@ -638,10 +638,10 @@ Approval requirements bypassed by manually added approval. {{end -}} This pull-request has been approved by:{{range $index, $approval := .ap.ListApprovals}}{{if $index}}, {{else}} {{end}}{{$approval}}{{end}} -{{- if (and (not .ap.AreFilesApproved) (not (call .ap.ManuallyApproved))) }} -To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign {{range $index, $cc := .ap.GetCCs}}{{if $index}}, {{end}}**{{$cc}}**{{end}} +{{ if (and (not .ap.AreFilesApproved) (not (call .ap.ManuallyApproved))) -}} +To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign {{range $index, $cc := .ap.GetCCs}}{{if $index}}, {{end}}**{{$cc}}**{{end}}. You can assign the PR to them by writing `+"`/{{.lhPrefix}}assign {{range $index, $cc := .ap.GetQuotedCCs .providerType}}{{if $index}} {{end}}@{{$cc}}{{end}}`"+` in a comment when ready. -{{- end}} +{{ end -}} {{if not .ap.RequireIssue -}} {{else if .ap.AssociatedIssue -}}