From f036b8f5a5d5131e8d9677aba564caf07e02938f Mon Sep 17 00:00:00 2001 From: Philipp Arndt <2f.mail@gmx.de> Date: Mon, 20 Jun 2022 07:44:46 +0200 Subject: [PATCH] fix: disable summary when it is not available --- dist/index.js | 10 ++++++++++ index.js | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/dist/index.js b/dist/index.js index 146194fe7..1a6f04aa2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -74623,6 +74623,7 @@ const cliParser = __nccwpck_require__(8604)() const findYarnWorkspaceRoot = __nccwpck_require__(6748) const debug = __nccwpck_require__(8237)('@cypress/github-action') const { ping } = __nccwpck_require__(9390) +const { SUMMARY_ENV_VAR } = __nccwpck_require__(1327) /** * Parses input command, finds the tool and @@ -75359,7 +75360,16 @@ const runTests = async () => { .then(onTestsFinished, onTestsError) } +// Summary is not available for GitHub Enterprise at the moment +const isSummaryEnabled = () => { + return process.env[SUMMARY_ENV_VAR] !== undefined +} + const generateSummary = async (testResults) => { + if (!isSummaryEnabled()) { + return testResults + } + const headers = [ { data: 'Result', header: true }, { data: 'Passed :white_check_mark:', header: true }, diff --git a/index.js b/index.js index 6e8a77603..422c8f342 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ const cliParser = require('argument-vector')() const findYarnWorkspaceRoot = require('find-yarn-workspace-root') const debug = require('debug')('@cypress/github-action') const { ping } = require('./src/ping') +const { SUMMARY_ENV_VAR } = require('@actions/core/lib/summary') /** * Parses input command, finds the tool and @@ -749,7 +750,16 @@ const runTests = async () => { .then(onTestsFinished, onTestsError) } +// Summary is not available for GitHub Enterprise at the moment +const isSummaryEnabled = () => { + return process.env[SUMMARY_ENV_VAR] !== undefined +} + const generateSummary = async (testResults) => { + if (!isSummaryEnabled()) { + return testResults + } + const headers = [ { data: 'Result', header: true }, { data: 'Passed :white_check_mark:', header: true },