diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 3567740..9225234 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -35,24 +35,17 @@ jobs: cat diff_output.txt | ansi2html > diff_output.html sed -i -n '/
/,/<\/pre>/p' diff_output.html
       
-      - name: Check for content
-        if: github.event_name == 'pull_request'
-        id: check_file
-        run: |
-            content=$(tr -d "[:space:]" < diff_output.html)
-            if [[ -n "$content" ]]; then
-              echo "::set-output name=hasContent::true"
-            else
-              echo "::set-output name=hasContent::false"
-            fi
-      
       - name: Post comment
-        if: github.event_name == 'pull_request' && steps.check_file.outputs.hasContent == 'true'
+        if: github.event_name == 'pull_request'
         uses: actions/github-script@v6
         with:
           script: |
             const fs = require('fs');
             const output = fs.readFileSync('diff_output.html', 'utf8');
+            if (!output.trim()) { // Check if the output only contains whitespace
+              console.log("Output is empty or only contains whitespace. Skipping comment post.");
+              return;
+            }
             const issue_number = context.issue.number;
             github.rest.issues.createComment({
               owner: context.repo.owner,