Skip to content

Commit de917dc

Browse files
authored
[workflow] Don't add a comment when the first run of the formatter passes (#86335)
This was inadvertently changed in 2120f57.
1 parent 4cea2d0 commit de917dc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.github/workflows/pr-code-format.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ jobs:
7373
# to take advantage of the new --diff_from_common_commit option
7474
# explicitly in code-format-helper.py and not have to diff starting at
7575
# the merge base.
76+
# Create an empty comments file so the pr-write job doesn't fail.
7677
run: |
78+
echo "[]" > comments &&
7779
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
7880
--write-comment-to-file \
7981
--token ${{ secrets.GITHUB_TOKEN }} \

llvm/utils/git/code-format-helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ def update_pr(self, comment_text: str, args: FormatArgs, create_new: bool) -> No
124124
existing_comment = self.find_comment(pr)
125125

126126
if args.write_comment_to_file:
127-
self.comment = {"body": comment_text}
127+
if create_new or existing_comment:
128+
self.comment = {"body": comment_text}
128129
if existing_comment:
129130
self.comment["id"] = existing_comment.id
130131
return

0 commit comments

Comments
 (0)