From b114ef26c25bc0cb7fd93de96efd2d10726096e9 Mon Sep 17 00:00:00 2001 From: Alexander Bayandin Date: Wed, 3 May 2023 15:38:49 +0100 Subject: [PATCH] GitHub Autocomment: add a note if no tests were run (#4109) - Always (if not cancelled) add a comment to a PR - Mention in the comment if no tests were run / reports were not generated. --- .github/workflows/build_and_test.yml | 5 +---- scripts/pr-comment-test-report.js | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e5ba7aa3eb..90f0395c7c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -418,10 +418,7 @@ jobs: - uses: actions/github-script@v6 if: > !cancelled() && - github.event_name == 'pull_request' && ( - steps.create-allure-report-debug.outputs.report-url || - steps.create-allure-report-release.outputs.report-url - ) + github.event_name == 'pull_request' with: # Retry script for 5XX server errors: https://github.com/actions/github-script#retries retries: 5 diff --git a/scripts/pr-comment-test-report.js b/scripts/pr-comment-test-report.js index 8df7248c4e..21386d3898 100644 --- a/scripts/pr-comment-test-report.js +++ b/scripts/pr-comment-test-report.js @@ -37,7 +37,7 @@ module.exports = async ({ github, context, fetch, reports }) => { const {buildType, reportUrl, jsonUrl} = report if (!reportUrl || !jsonUrl) { - console.warn(`"reportUrl" or "jsonUrl" aren't set for ${buildType} build`) + commentBody += `#### ${buildType} build: no tests were run or test report is not available\n` continue } @@ -78,7 +78,7 @@ module.exports = async ({ github, context, fetch, reports }) => { } const totalTestsCount = failedTests.length + passedTests.length + skippedTests.length - commentBody += `#### ${buildType} build: ${totalTestsCount} tests run: ${passedTests.length} passed, ${failedTests.length} failed, ${skippedTests.length} ([full report](${reportUrl}))\n` + commentBody += `#### ${buildType} build: ${totalTestsCount} tests run: ${passedTests.length} passed, ${failedTests.length} failed, ${skippedTests.length} skipped ([full report](${reportUrl}))\n` if (failedTests.length > 0) { commentBody += `Failed tests:\n` for (const test of failedTests) {