From d68dd23a56fa93a4ff648a4a83ddb4781b2642b2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 11 Oct 2022 20:58:00 +0200 Subject: [PATCH] GNU comment: Only display a comment if there is any (#4026) * GNU comment: Only display a comment if there is any --- .github/workflows/GnuComment.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/GnuComment.yml b/.github/workflows/GnuComment.yml index cf85e37bb..d176b0a1d 100644 --- a/.github/workflows/GnuComment.yml +++ b/.github/workflows/GnuComment.yml @@ -44,9 +44,15 @@ jobs: script: | var fs = require('fs'); var issue_number = Number(fs.readFileSync('./NR')); - await github.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue_number, - body: 'GNU testsuite comparison:\n```' + fs.readFileSync('./result.txt') + '\n```' - }); + var content = fs.readFileSync('./result.txt'); + console.log(content); + console.log(content.trim()); + console.log(content.trim().length); + if (content.trim().length > 7) { // 7 because we have backquote + \n + await github.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + body: 'GNU testsuite comparison:\n```' + content + '\n```' + }); + }