diff --git a/.github/workflows/pyrefly-diff-comment.yml b/.github/workflows/pyrefly-diff-comment.yml
index eefb1ebbb9..c55b013dbe 100644
--- a/.github/workflows/pyrefly-diff-comment.yml
+++ b/.github/workflows/pyrefly-diff-comment.yml
@@ -76,13 +76,11 @@ jobs:
diff += '\\n\\n... (truncated) ...';
}
- const body = diff.trim()
- ? '### Pyrefly Diff\n\nbase → PR
\n\n```diff\n' + diff + '\n```\n '
- : '### Pyrefly Diff\nNo changes detected.';
-
- await github.rest.issues.createComment({
- issue_number: prNumber,
- owner: context.repo.owner,
- repo: context.repo.repo,
- body,
- });
+ if (diff.trim()) {
+ await github.rest.issues.createComment({
+ issue_number: prNumber,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ body: '### Pyrefly Diff\n\nbase → PR
\n\n```diff\n' + diff + '\n```\n ',
+ });
+ }