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

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 13:00:33 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-github-workflow

Author: Tom Stellard (tstellar)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/86335.diff


2 Files Affected:

- (modified) .github/workflows/pr-code-format.yml (-1) 
- (modified) llvm/utils/git/code-format-helper.py (+2-1) 


``````````diff
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
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

``````````

</details>


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


More information about the llvm-commits mailing list