Skip to content

Commit

Permalink
feat: Adding new input command for enabled or not job summary publish…
Browse files Browse the repository at this point in the history
…ment (#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 <[email protected]>

* Update README.md

Co-authored-by: Bill Glesias <[email protected]>

* Update action.yml

Co-authored-by: Bill Glesias <[email protected]>

* Update README.md

* Update README.md

* Following agreement

* Update README

* Add introduction sentence

* Update README.md

Co-authored-by: Mike McCready <[email protected]>

* Update README.md

Co-authored-by: Mike McCready <[email protected]>

---------

Co-authored-by: Tom Darneix <[email protected]>
Co-authored-by: Zach Bloomquist <[email protected]>
Co-authored-by: Bill Glesias <[email protected]>
Co-authored-by: Mike McCready <[email protected]>
Co-authored-by: Matt Henkes <[email protected]>
  • Loading branch information
6 people authored Mar 8, 2023
1 parent 88c8045 commit 4d47587
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 4d47587

Please sign in to comment.