From 4d475873e011991664253f34700acfc3acdc46a3 Mon Sep 17 00:00:00 2001 From: SoldierBoy31 <112397130+SoldierBoy31@users.noreply.github.com> Date: Wed, 8 Mar 2023 20:44:43 +0100 Subject: [PATCH] feat: Adding new input command for enabled or not job summary publishment (#721) * Adding new input command for enabled or not job summary publishment after ran tests. This will allow better readability on parallel tests * Adding builded script * Update summary input with more explicit name * Update builded script * Add documentation * Remove comment * Apply prettier and build commands * Update README.md Co-authored-by: Bill Glesias * Update README.md Co-authored-by: Bill Glesias * Update action.yml Co-authored-by: Bill Glesias * Update README.md * Update README.md * Following agreement * Update README * Add introduction sentence * Update README.md Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> * Update README.md Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> --------- Co-authored-by: Tom Darneix Co-authored-by: Zach Bloomquist Co-authored-by: Bill Glesias Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Co-authored-by: Matt Henkes --- README.md | 22 ++++++++++++++++++++++ action.yml | 4 ++++ dist/index.js | 3 ++- index.js | 3 ++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e15f969ea..db8fafbab 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ - [timeouts](#timeouts) to avoid hanging CI jobs - [print Cypress info](#print-cypress-info) like detected browsers - [run tests nightly](#nightly-tests) or on any schedule +- [Suppress test summary](#suppress-test-summary) - [more examples](#more-examples) Current examples contained in this repository are based on Cypress 12.x and can be found in the [examples](./examples) directory. Examples for [Legacy Configuration](https://on.cypress.io/guides/references/legacy-configuration) use Cypress `9.7.0` and are kept in the [examples/v9](./examples/v9) directory. @@ -1347,6 +1348,27 @@ See the [example-cron.yml](./.github/workflows/example-cron.yml) workflow. [![cron example](https://github.com/cypress-io/github-action/workflows/example-cron/badge.svg?branch=master)](.github/workflows/example-cron.yml) +### Suppress test summary + +The default test summary can be suppressed by using the parameter `publish-summary` and setting its value to `false`. +Sometimes users want to publish test summary using a specific action. +For example, a user running Cypress tests using a matrix and wants to retrieve the test summary for each matrix job and use a specific action that merges reports. + +```yml +name: Example no summary +on: push +jobs: + cypress-run: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Cypress run + uses: cypress-io/github-action@v5 + with: + publish-summary: false +``` + ## Changelog See [Releases](https://github.com/cypress-io/github-action/releases) for full details of changes. diff --git a/action.yml b/action.yml index 5fd82acd5..26b016429 100644 --- a/action.yml +++ b/action.yml @@ -65,6 +65,10 @@ inputs: headed: description: 'Whether or not to use headed mode' required: false + publish-summary: + description: 'Whether or not to publish job summary' + required: false + default: true spec: description: 'Provide a specific specs to run' required: false diff --git a/dist/index.js b/dist/index.js index 73e90d28f..5da4e51a9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -79227,7 +79227,8 @@ const runTests = async () => { // Summary is not available for GitHub Enterprise at the moment const isSummaryEnabled = () => { - return process.env[SUMMARY_ENV_VAR] !== undefined + const isSummaryInput = getInputBool('publish-summary') + return process.env[SUMMARY_ENV_VAR] !== undefined && isSummaryInput } const generateSummary = async (testResults) => { diff --git a/index.js b/index.js index bcd65774a..72b07f359 100644 --- a/index.js +++ b/index.js @@ -781,7 +781,8 @@ const runTests = async () => { // Summary is not available for GitHub Enterprise at the moment const isSummaryEnabled = () => { - return process.env[SUMMARY_ENV_VAR] !== undefined + const isSummaryInput = getInputBool('publish-summary') + return process.env[SUMMARY_ENV_VAR] !== undefined && isSummaryInput } const generateSummary = async (testResults) => {