Skip to content

Commit 4d47587

Browse files
SoldierBoy31ThebardaflotwigAtofStrykerMikeMcC399
authored
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 <[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]>
1 parent 88c8045 commit 4d47587

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
- [timeouts](#timeouts) to avoid hanging CI jobs
4343
- [print Cypress info](#print-cypress-info) like detected browsers
4444
- [run tests nightly](#nightly-tests) or on any schedule
45+
- [Suppress test summary](#suppress-test-summary)
4546
- [more examples](#more-examples)
4647

4748
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.
13471348

13481349
[![cron example](https://github.com/cypress-io/github-action/workflows/example-cron/badge.svg?branch=master)](.github/workflows/example-cron.yml)
13491350

1351+
### Suppress test summary
1352+
1353+
The default test summary can be suppressed by using the parameter `publish-summary` and setting its value to `false`.
1354+
Sometimes users want to publish test summary using a specific action.
1355+
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.
1356+
1357+
```yml
1358+
name: Example no summary
1359+
on: push
1360+
jobs:
1361+
cypress-run:
1362+
runs-on: ubuntu-22.04
1363+
steps:
1364+
- name: Checkout
1365+
uses: actions/checkout@v3
1366+
- name: Cypress run
1367+
uses: cypress-io/github-action@v5
1368+
with:
1369+
publish-summary: false
1370+
```
1371+
13501372
## Changelog
13511373

13521374
See [Releases](https://github.com/cypress-io/github-action/releases) for full details of changes.

action.yml

+4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ inputs:
6565
headed:
6666
description: 'Whether or not to use headed mode'
6767
required: false
68+
publish-summary:
69+
description: 'Whether or not to publish job summary'
70+
required: false
71+
default: true
6872
spec:
6973
description: 'Provide a specific specs to run'
7074
required: false

dist/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -79227,7 +79227,8 @@ const runTests = async () => {
7922779227

7922879228
// Summary is not available for GitHub Enterprise at the moment
7922979229
const isSummaryEnabled = () => {
79230-
return process.env[SUMMARY_ENV_VAR] !== undefined
79230+
const isSummaryInput = getInputBool('publish-summary')
79231+
return process.env[SUMMARY_ENV_VAR] !== undefined && isSummaryInput
7923179232
}
7923279233

7923379234
const generateSummary = async (testResults) => {

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,8 @@ const runTests = async () => {
781781

782782
// Summary is not available for GitHub Enterprise at the moment
783783
const isSummaryEnabled = () => {
784-
return process.env[SUMMARY_ENV_VAR] !== undefined
784+
const isSummaryInput = getInputBool('publish-summary')
785+
return process.env[SUMMARY_ENV_VAR] !== undefined && isSummaryInput
785786
}
786787

787788
const generateSummary = async (testResults) => {

0 commit comments

Comments
 (0)