From f0e6f11c1c871d794b124c2bc41c9099d7508df2 Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Tue, 31 Mar 2026 11:11:21 +0900 Subject: [PATCH] fix: silent diff when number count are the same (#34097) --- .github/workflows/pyrefly-diff.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pyrefly-diff.yml b/.github/workflows/pyrefly-diff.yml index 0b2a7b8e9e..8623d35b04 100644 --- a/.github/workflows/pyrefly-diff.yml +++ b/.github/workflows/pyrefly-diff.yml @@ -50,6 +50,17 @@ jobs: run: | diff -u /tmp/pyrefly_base.txt /tmp/pyrefly_pr.txt > pyrefly_diff.txt || true + - name: Check if line counts match + id: line_count_check + run: | + base_lines=$(wc -l < /tmp/pyrefly_base.txt) + pr_lines=$(wc -l < /tmp/pyrefly_pr.txt) + if [ "$base_lines" -eq "$pr_lines" ]; then + echo "same=true" >> $GITHUB_OUTPUT + else + echo "same=false" >> $GITHUB_OUTPUT + fi + - name: Save PR number run: | echo ${{ github.event.pull_request.number }} > pr_number.txt @@ -63,7 +74,7 @@ jobs: pr_number.txt - name: Comment PR with pyrefly diff - if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + if: ${{ github.event.pull_request.head.repo.full_name == github.repository && steps.line_count_check.outputs.same == 'false' }} uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: github-token: ${{ secrets.GITHUB_TOKEN }}