[llvm] Code format comment fix (PR #86335)

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 12:59:59 PDT 2024


https://github.com/tstellar created https://github.com/llvm/llvm-project/pull/86335

None

>From 6538914d0b71c98db4ab7d8bffb5d60814cbaacf Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Fri, 22 Mar 2024 12:56:00 -0700
Subject: [PATCH 1/2] [workflow] Don't add a comment when the first run of the
 formatter passes

This was inadvertently changed in
2120f574103c487787390263b3692c4b167f6bdf.
---
 llvm/utils/git/code-format-helper.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index af1bb3b5aec58d..f1207026704e88 100755
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -124,7 +124,8 @@ def update_pr(self, comment_text: str, args: FormatArgs, create_new: bool) -> No
         existing_comment = self.find_comment(pr)
 
         if args.write_comment_to_file:
-            self.comment = {"body": comment_text}
+            if create_new or existing_comment:
+                self.comment = {"body": comment_text}
             if existing_comment:
                 self.comment["id"] = existing_comment.id
             return

>From 6f2463cef42eda6e27522b888fa229af71f1ff47 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Fri, 22 Mar 2024 12:57:59 -0700
Subject: [PATCH 2/2] XXX: debug

---
 .github/workflows/pr-code-format.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index 2ed9b05cac120f..7adca02930237d 100644
--- a/.github/workflows/pr-code-format.yml
+++ b/.github/workflows/pr-code-format.yml
@@ -34,7 +34,6 @@ jobs:
         uses: actions/checkout at v4
         with:
           reository: ${{ github.repository }}
-          ref: ${{ github.base_ref }}
           sparse-checkout: |
             llvm/utils/git/requirements_formatting.txt
             llvm/utils/git/code-format-helper.py



More information about the llvm-commits mailing list