[llvm] [Github] Fix comment formatting for code format action (PR #75764)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 17 19:26:31 PST 2023


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/75764

Before this patch, there was a regression in comment formatting due to some code formatting in bd3e8eb6e325081bf7cfbe93652aa825de3170e5. Github interprets a tab before a string as starting code formatting. The message that indicted the code formatting in a PR had been fixed was refactored to a python multi-line string, but with a tab in front, causing these messages to be rendered as code blocks in Github, instead of as intended. This patch changes this back to a single line string to prevent this issue.

This fixes #75725.

>From fe7af3465095c5dcfa7f715660c1515b895f21ba Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Mon, 18 Dec 2023 03:21:16 +0000
Subject: [PATCH] [Github] Fix comment formatting for code format action

Before this patch, there was a regression in comment formatting due to
some code formatting in bd3e8eb6e325081bf7cfbe93652aa825de3170e5. Github
interprets a tab before a string as starting code formatting. The
message that indicted the code formatting in a PR had been fixed was
refactored to a python multi-line string, but with a tab in front,
causing these messages to be rendered as code blocks in Github, instead
of as intended. This patch changes this back to a single line string to
prevent this issue.
---
 llvm/utils/git/code-format-helper.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index 697a27ab82a750..b321acded650b6 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -130,9 +130,7 @@ def run(self, changed_files: List[str], args: FormatArgs) -> bool:
 
         if diff is None:
             if should_update_gh:
-                comment_text = f"""
-    :white_check_mark: With the latest revision this PR passed the {self.friendly_name}.
-    """
+                comment_text = f":white_check_mark: With the latest revision this PR passed the {self.friendly_name}."
                 self.update_pr(comment_text, args, create_new=False)
             return True
         elif len(diff) > 0:



More information about the llvm-commits mailing list