@cypress/github-action 6.5.0 → 6.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,6 +21,10 @@
21
21
  - Run only some [spec files](#specs)
22
22
  - Test [project in subfolder](#project)
23
23
  - [Record results](#record-test-results-on-cypress-cloud) on Cypress Cloud
24
+ - Storing the [Project ID and Record Key](#project-id-and-record-key)
25
+ - Getting [Git information](#git-information) environment variables
26
+ - Getting [PR and URL](#automatic-pr-number-and-url-detection) automatically
27
+ - Overwriting [Merge SHA into SHA](#merge-sha-into-sha) message
24
28
  - Tag [recordings](#tag-recordings)
25
29
  - Specify [auto cancel](#specify-auto-cancel-after-failures) after failures
26
30
  - Store [test artifacts](#artifacts) on GitHub
@@ -54,7 +58,8 @@
54
58
  - Use [timeouts](#timeouts) to avoid hanging CI jobs
55
59
  - Print [Cypress info](#print-cypress-info) like detected browsers
56
60
  - Run [tests nightly](#nightly-tests) or on any schedule
57
- - Suppress [test summary](#suppress-test-summary)
61
+ - Specify [job summary title](#job-summary-title)
62
+ - Suppress [job summary](#suppress-job-summary)
58
63
  - [More examples](#more-examples)
59
64
 
60
65
  Examples contained in this repository, based on current Cypress versions, can be found in the [examples](./examples) directory. Examples for [Legacy Configuration](https://on.cypress.io/guides/references/legacy-configuration), which use Cypress `9.7.0`, are no longer maintained. They can be referred to in the [examples/v9](https://github.com/cypress-io/github-action/tree/v5/examples/v9) directory of the [v5](https://github.com/cypress-io/github-action/tree/v5/) branch.
@@ -77,7 +82,7 @@ jobs:
77
82
  runs-on: ubuntu-22.04
78
83
  steps:
79
84
  - name: Checkout
80
- uses: actions/checkout@v3
85
+ uses: actions/checkout@v4
81
86
  # Install npm dependencies, cache them correctly
82
87
  # and run all Cypress tests
83
88
  - name: Cypress run
@@ -102,7 +107,7 @@ jobs:
102
107
  runs-on: ubuntu-22.04
103
108
  steps:
104
109
  - name: Checkout
105
- uses: actions/checkout@v3
110
+ uses: actions/checkout@v4
106
111
  - name: Cypress run
107
112
  uses: cypress-io/github-action@v6
108
113
  with:
@@ -133,7 +138,7 @@ Alternatively, to mitigate unforeseen breaks, bind to a specific [tag](https://g
133
138
  uses: cypress-io/github-action@v6.1.0
134
139
  ```
135
140
 
136
- The changes associated with each tag are shown under GitHub's [releases](https://github.com/cypress-io/github-action/releases) list. Refer also to the [Changelog](#changelog) for an overview of major changes.
141
+ The changes associated with each tag are shown under GitHub's [releases](https://github.com/cypress-io/github-action/releases) list. Refer also to the [CHANGELOG](./CHANGELOG.md) for an overview of major changes.
137
142
 
138
143
  ### Browser
139
144
 
@@ -149,7 +154,7 @@ jobs:
149
154
  runs-on: ubuntu-22.04
150
155
  name: E2E on Chrome
151
156
  steps:
152
- - uses: actions/checkout@v3
157
+ - uses: actions/checkout@v4
153
158
  - uses: cypress-io/github-action@v6
154
159
  with:
155
160
  browser: chrome
@@ -167,7 +172,7 @@ jobs:
167
172
  runs-on: ubuntu-22.04
168
173
  name: E2E on Firefox
169
174
  steps:
170
- - uses: actions/checkout@v3
175
+ - uses: actions/checkout@v4
171
176
  - uses: cypress-io/github-action@v6
172
177
  with:
173
178
  browser: firefox
@@ -185,7 +190,7 @@ jobs:
185
190
  runs-on: ubuntu-22.04
186
191
  name: E2E on Edge
187
192
  steps:
188
- - uses: actions/checkout@v3
193
+ - uses: actions/checkout@v4
189
194
  - uses: cypress-io/github-action@v6
190
195
  with:
191
196
  browser: edge
@@ -204,7 +209,7 @@ jobs:
204
209
  cypress-run:
205
210
  runs-on: ubuntu-22.04
206
211
  steps:
207
- - uses: actions/checkout@v3
212
+ - uses: actions/checkout@v4
208
213
  - uses: cypress-io/github-action@v6
209
214
  with:
210
215
  browser: chrome
@@ -227,7 +232,7 @@ jobs:
227
232
  image: cypress/browsers:latest
228
233
  options: --user 1001
229
234
  steps:
230
- - uses: actions/checkout@v3
235
+ - uses: actions/checkout@v4
231
236
  - uses: cypress-io/github-action@v6
232
237
  with:
233
238
  browser: chrome
@@ -253,7 +258,7 @@ jobs:
253
258
  runs-on: ubuntu-22.04
254
259
  steps:
255
260
  - name: Checkout
256
- uses: actions/checkout@v3
261
+ uses: actions/checkout@v4
257
262
 
258
263
  - name: Cypress run with env
259
264
  uses: cypress-io/github-action@v6
@@ -271,7 +276,7 @@ jobs:
271
276
  runs-on: ubuntu-22.04
272
277
  steps:
273
278
  - name: Checkout
274
- uses: actions/checkout@v3
279
+ uses: actions/checkout@v4
275
280
 
276
281
  - name: Cypress run with env
277
282
  uses: cypress-io/github-action@v6
@@ -297,7 +302,7 @@ jobs:
297
302
  runs-on: ubuntu-22.04
298
303
  steps:
299
304
  - name: Checkout
300
- uses: actions/checkout@v3
305
+ uses: actions/checkout@v4
301
306
 
302
307
  - name: Cypress run
303
308
  uses: cypress-io/github-action@v6
@@ -328,7 +333,7 @@ jobs:
328
333
  runs-on: ubuntu-22.04
329
334
  steps:
330
335
  - name: Checkout
331
- uses: actions/checkout@v3
336
+ uses: actions/checkout@v4
332
337
  - name: Cypress run
333
338
  uses: cypress-io/github-action@v6
334
339
  with:
@@ -341,6 +346,8 @@ For more information, visit [the Cypress command-line docs](https://on.cypress.i
341
346
 
342
347
  By setting the parameter `record` to `true`, you can record your test results into the [Cypress Cloud](https://on.cypress.io/cloud). Read the [Cypress Cloud documentation](https://on.cypress.io/guides/cloud/introduction) to learn how to sign up and create a Cypress Cloud project.
343
348
 
349
+ We recommend passing the `GITHUB_TOKEN` secret (created by the GH Action automatically) as an environment variable. This will allow correctly identifying every build and avoid confusion when re-running a build.
350
+
344
351
  ```yml
345
352
  name: Cypress tests
346
353
  on: push
@@ -350,28 +357,24 @@ jobs:
350
357
  runs-on: ubuntu-22.04
351
358
  steps:
352
359
  - name: Checkout
353
- uses: actions/checkout@v3
360
+ uses: actions/checkout@v4
354
361
 
355
362
  - name: Cypress run
356
363
  uses: cypress-io/github-action@v6
357
364
  with:
358
365
  record: true
359
366
  env:
360
- # pass the Cypress Cloud record key as an environment variable
361
- CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
362
367
  # pass GitHub token to allow accurately detecting a build vs a re-run build
363
368
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
364
369
  ```
365
370
 
366
371
  [![recording example](https://github.com/cypress-io/github-action/workflows/example-recording/badge.svg?branch=master)](.github/workflows/example-recording.yml)
367
372
 
368
- **Tip 1:** We recommend using the action with `on: push` instead of `on: pull_request` to get the most accurate information related to the commit on Cypress Cloud. With pull requests, the merge commit is created automatically and might not correspond to a meaningful commit in the repository.
373
+ ### Project ID and Record Key
369
374
 
370
- **Tip 2:** we recommend passing the `GITHUB_TOKEN` secret (created by the GH Action automatically) as an environment variable. This will allow correctly identifying every build and avoid confusion when re-running a build.
375
+ To record the project needs `projectId` and `recordKey`.
371
376
 
372
- **Tip 3:** if running on `pull_request` event, the commit message is "merge SHA into SHA", which is not what you want probably. You can overwrite the commit message sent to Cypress Cloud by setting an environment variable. See [issue 124](https://github.com/cypress-io/github-action/issues/124#issuecomment-653180260) for details.
373
-
374
- **Tip 4:** to record the project needs `projectId`. Typically this value is saved in the [Cypress Configuration File](https://docs.cypress.io/guides/references/configuration#Configuration-File). If you want to avoid this, pass the `projectId` using an environment variable:
377
+ Typically, the `projectId` is stored in the [Cypress Configuration File](https://docs.cypress.io/guides/references/configuration#Configuration-File), while the `recordKey` is set as a [CLI parameter](https://docs.cypress.io/guides/guides/command-line#cypress-run-record-key-lt-record-key-gt). If you want to avoid this, both the `projectId` and `recordKey` can be provided as environment variables using [GitHub secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).
375
378
 
376
379
  ```yml
377
380
  name: Cypress tests
@@ -382,7 +385,7 @@ jobs:
382
385
  runs-on: ubuntu-22.04
383
386
  steps:
384
387
  - name: Checkout
385
- uses: actions/checkout@v3
388
+ uses: actions/checkout@v4
386
389
 
387
390
  - name: Cypress run
388
391
  uses: cypress-io/github-action@v6
@@ -391,12 +394,107 @@ jobs:
391
394
  env:
392
395
  # pass the Cypress Cloud record key as an environment variable
393
396
  CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
394
- # pass GitHub token to allow accurately detecting a build vs a re-run build
395
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
396
397
  # pass the project ID from the secrets through environment variable
397
398
  CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }}
398
399
  ```
399
400
 
401
+ ### Git information
402
+
403
+ Cypress uses the [@cypress/commit-info](https://github.com/cypress-io/commit-info) package to associate Git details (branch, commit message, author) with each run. It typically uses Git commands, expecting a .git folder. In Docker or similar environments where .git is absent, or if you need different data in the Cypress Cloud, Git information can be passed via custom environment variables.
404
+
405
+ ```yml
406
+ name: Cypress tests
407
+ on: push
408
+ jobs:
409
+ cypress-run:
410
+ name: Cypress run
411
+ runs-on: ubuntu-22.04
412
+ steps:
413
+ - name: Checkout
414
+ uses: actions/checkout@v4
415
+
416
+ - name: Cypress run
417
+ uses: cypress-io/github-action@v6
418
+ with:
419
+ record: true
420
+ env:
421
+ # Get the short ref name of the branch that triggered the workflow run
422
+ COMMIT_INFO_BRANCH: ${{ github.ref_name }}
423
+ ```
424
+
425
+ Please refer to the [Cypress Cloud Git information environment variables](https://on.cypress.io/guides/continuous-integration/introduction#Git-information) section in our documentation for more examples.
426
+
427
+ Please refer to the [default GitHub environment variables](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) for additional GitHub examples.
428
+
429
+ ### Automatic PR number and URL detection
430
+
431
+ When recording runs to Cypress Cloud, the PR number and URL can be automatically detected if you pass `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`
432
+ via the workflow `env`. When set, this value enables the Action to perform additional logic that grabs the related PR number and URL (if they
433
+ exist) and sets them in the environment variables `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
434
+ * See Cypress' documentation on [CI Build Information](https://on.cypress.io/guides/continuous-integration/introduction#CI-Build-Information)
435
+
436
+ Example workflow using the variables:
437
+ ```yml
438
+ name: Example echo PR number and URL
439
+ on: push
440
+ jobs:
441
+ cypress-run:
442
+ runs-on: ubuntu-22.04
443
+ steps:
444
+ - name: Checkout
445
+ uses: actions/checkout@v4
446
+ - name: Cypress run
447
+ uses: cypress-io/github-action@v6
448
+ with:
449
+ record: true
450
+ - run: echo "PR number is $CYPRESS_PULL_REQUEST_ID"
451
+ - run: echo "PR URL is $CYPRESS_PULL_REQUEST_URL"
452
+ env:
453
+ CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
454
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
455
+ ```
456
+
457
+ #### Triggering event: `pull_request`/`pull_request_target`
458
+
459
+ For either of these events, we set `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` to that of the PR number and URL, respectively, of the
460
+ PR that triggered the workflow.
461
+
462
+ #### Triggering event: `push`
463
+
464
+ When a commit on a branch without a PR is made, the Cypress GitHub Action checks to see if the commit that triggered the workflow has a
465
+ related PR. If the commit exists in any other PRs, it's considered a related PR. When there are related PRs, we grab the first related PR
466
+ and use that PR's number and URL for `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
467
+
468
+ If no related PR is detected, `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` will be undefined.
469
+
470
+ ### Merge SHA into SHA
471
+
472
+ We recommend using the action with `on: push` rather than `on: pull_request` or `on: merge_group` for more accurate commit information in Cypress Cloud. When running on pull_request or merge_group, the commit message defaults to "merge SHA into SHA". You can overwrite the commit message sent to Cypress Cloud by setting an environment variable.
473
+
474
+ ```yml
475
+ name: Cypress tests
476
+ on: push
477
+ jobs:
478
+ cypress-run:
479
+ name: Cypress run
480
+ runs-on: ubuntu-22.04
481
+ steps:
482
+ - name: Checkout
483
+ uses: actions/checkout@v4
484
+
485
+ - name: Cypress run
486
+ uses: cypress-io/github-action@v6
487
+ with:
488
+ record: true
489
+ env:
490
+ # overwrite commit message sent to Cypress Cloud
491
+ COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
492
+ # re-enable PR comment bot
493
+ COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}
494
+ ```
495
+
496
+ See [issue 124](https://github.com/cypress-io/github-action/issues/124#issuecomment-1076826988) for details.
497
+
400
498
  ### Tag recordings
401
499
 
402
500
  You can pass a single or multiple tags when recording a run. For example
@@ -410,17 +508,17 @@ jobs:
410
508
  # let's make sure our "app" works on several versions of Node
411
509
  strategy:
412
510
  matrix:
413
- node: [18, 20]
511
+ node: [18, 20, 21]
414
512
  name: E2E on Node v${{ matrix.node }}
415
513
  steps:
416
514
  - name: Setup Node
417
- uses: actions/setup-node@v3
515
+ uses: actions/setup-node@v4
418
516
  with:
419
517
  node-version: ${{ matrix.node }}
420
518
  - run: node -v
421
519
 
422
520
  - name: Checkout
423
- uses: actions/checkout@v3
521
+ uses: actions/checkout@v4
424
522
 
425
523
  - name: Cypress run
426
524
  uses: cypress-io/github-action@v6
@@ -454,7 +552,7 @@ jobs:
454
552
  steps:
455
553
 
456
554
  - name: Checkout
457
- uses: actions/checkout@v3
555
+ uses: actions/checkout@v4
458
556
 
459
557
  - name: Cypress run
460
558
  uses: cypress-io/github-action@v6
@@ -481,17 +579,17 @@ jobs:
481
579
  runs-on: ubuntu-22.04
482
580
  name: Artifacts
483
581
  steps:
484
- - uses: actions/checkout@v3
582
+ - uses: actions/checkout@v4
485
583
  - uses: cypress-io/github-action@v6
486
584
  # after the test run completes store videos and any screenshots
487
- - uses: actions/upload-artifact@v3
585
+ - uses: actions/upload-artifact@v4
488
586
  # add the line below to store screenshots only on failures
489
587
  # if: failure()
490
588
  with:
491
589
  name: cypress-screenshots
492
590
  path: cypress/screenshots
493
591
  if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
494
- - uses: actions/upload-artifact@v3
592
+ - uses: actions/upload-artifact@v4
495
593
  with:
496
594
  name: cypress-videos
497
595
  path: cypress/videos
@@ -510,7 +608,7 @@ jobs:
510
608
  runs-on: ubuntu-22.04
511
609
  steps:
512
610
  - name: Checkout
513
- uses: actions/checkout@v3
611
+ uses: actions/checkout@v4
514
612
  # Install npm dependencies, cache them correctly
515
613
  # and run all Cypress tests with `quiet` parameter
516
614
  - name: Cypress run
@@ -535,7 +633,7 @@ jobs:
535
633
  runs-on: ubuntu-22.04
536
634
  steps:
537
635
  - name: Checkout
538
- uses: actions/checkout@v3
636
+ uses: actions/checkout@v4
539
637
 
540
638
  - name: Cypress run
541
639
  uses: cypress-io/github-action@v6
@@ -547,7 +645,7 @@ jobs:
547
645
 
548
646
  ### Config File
549
647
 
550
- Specify the path to your config file with `config-file` parameter
648
+ Specify the path to your [Configuration File](https://on.cypress.io/guides/references/configuration#Configuration-File) with `config-file` parameter
551
649
 
552
650
  ```yml
553
651
  name: Cypress tests
@@ -558,14 +656,16 @@ jobs:
558
656
  runs-on: ubuntu-22.04
559
657
  steps:
560
658
  - name: Checkout
561
- uses: actions/checkout@v3
659
+ uses: actions/checkout@v4
562
660
 
563
661
  - name: Cypress run
564
662
  uses: cypress-io/github-action@v6
565
663
  with:
566
- config-file: tests/cypress-config.json
664
+ config-file: cypress.config-alternate.js
567
665
  ```
568
666
 
667
+ [![example-config](https://github.com/cypress-io/github-action/workflows/example-config/badge.svg?branch=master)](.github/workflows/example-config.yml)
668
+
569
669
  ### Parallel
570
670
 
571
671
  **Note:** Cypress parallelization requires a [Cypress Cloud](https://on.cypress.io/cloud-introduction) account.
@@ -590,7 +690,7 @@ jobs:
590
690
  containers: [1, 2, 3]
591
691
  steps:
592
692
  - name: Checkout
593
- uses: actions/checkout@v3
693
+ uses: actions/checkout@v4
594
694
 
595
695
  # because of "record" and "parallel" parameters
596
696
  # these containers will load balance all found tests among themselves
@@ -646,7 +746,7 @@ jobs:
646
746
  runs-on: ubuntu-22.04
647
747
  steps:
648
748
  - name: Checkout
649
- uses: actions/checkout@v3
749
+ uses: actions/checkout@v4
650
750
  - name: Cypress run
651
751
  uses: cypress-io/github-action@v6
652
752
  with:
@@ -665,7 +765,7 @@ jobs:
665
765
  runs-on: ubuntu-22.04
666
766
  steps:
667
767
  - name: Checkout
668
- uses: actions/checkout@v3
768
+ uses: actions/checkout@v4
669
769
  - name: Cypress run
670
770
  uses: cypress-io/github-action@v6
671
771
  with:
@@ -683,7 +783,7 @@ jobs:
683
783
  runs-on: ubuntu-22.04
684
784
  steps:
685
785
  - name: Checkout
686
- uses: actions/checkout@v3
786
+ uses: actions/checkout@v4
687
787
  - name: Cypress run
688
788
  uses: cypress-io/github-action@v6
689
789
  with:
@@ -709,7 +809,7 @@ jobs:
709
809
  runs-on: ubuntu-22.04
710
810
  steps:
711
811
  - name: Checkout
712
- uses: actions/checkout@v3
812
+ uses: actions/checkout@v4
713
813
  - name: Cypress run
714
814
  uses: cypress-io/github-action@v6
715
815
  with:
@@ -739,7 +839,7 @@ jobs:
739
839
  runs-on: ubuntu-22.04
740
840
  steps:
741
841
  - name: Checkout
742
- uses: actions/checkout@v3
842
+ uses: actions/checkout@v4
743
843
  - name: Cypress run
744
844
  uses: cypress-io/github-action@v6
745
845
  with:
@@ -824,7 +924,7 @@ jobs:
824
924
  runs-on: ubuntu-22.04
825
925
  steps:
826
926
  - name: Checkout
827
- uses: actions/checkout@v3
927
+ uses: actions/checkout@v4
828
928
  - name: Cypress run
829
929
  uses: cypress-io/github-action@v6
830
930
  with:
@@ -843,7 +943,7 @@ You can overwrite the Cypress run command with your own command.
843
943
  ```yml
844
944
  steps:
845
945
  - name: Checkout 🛎
846
- uses: actions/checkout@v3
946
+ uses: actions/checkout@v4
847
947
 
848
948
  - name: Custom tests 🧪
849
949
  uses: cypress-io/github-action@v6
@@ -870,7 +970,7 @@ jobs:
870
970
  # run 3 copies of the current job in parallel
871
971
  containers: [1, 2, 3]
872
972
  steps:
873
- - uses: actions/checkout@v3
973
+ - uses: actions/checkout@v4
874
974
  - uses: cypress-io/github-action@v6
875
975
  with:
876
976
  record: true
@@ -905,7 +1005,7 @@ jobs:
905
1005
  smoke-tests:
906
1006
  needs: ['prepare']
907
1007
  steps:
908
- - uses: actions/checkout@v3
1008
+ - uses: actions/checkout@v4
909
1009
  - uses: cypress-io/github-action@v6
910
1010
  with:
911
1011
  record: true
@@ -945,7 +1045,7 @@ jobs:
945
1045
  cypress-run:
946
1046
  runs-on: ubuntu-22.04
947
1047
  steps:
948
- - uses: actions/checkout@v3
1048
+ - uses: actions/checkout@v4
949
1049
  - uses: cypress-io/github-action@v6
950
1050
  with:
951
1051
  start: npm start
@@ -958,7 +1058,7 @@ Each of the examples in this monorepo is separated from other examples by using
958
1058
 
959
1059
  ### Subfolders
960
1060
 
961
- Sometimes Cypress and end-to-end tests have their own `package.json` file in a subfolder, like
1061
+ Sometimes the application under test and the Cypress end-to-end tests may have separately defined dependencies. In the example below, Cypress has its own `package.json` file in a subfolder:
962
1062
 
963
1063
  ```text
964
1064
  root/
@@ -966,15 +1066,15 @@ root/
966
1066
  (code for installing and running Cypress tests)
967
1067
  package.json
968
1068
  package-lock.json
969
- cypress.json
970
- cypress
1069
+ cypress.config.js
1070
+ cypress/
971
1071
 
972
1072
  (code for running the "app" with "npm start")
973
1073
  package.json
974
- yarn.lock
1074
+ package-lock.json
975
1075
  ```
976
1076
 
977
- In that case you can combine this action with [bahmutov/npm-install](https://github.com/bahmutov/npm-install) action to install dependencies separately.
1077
+ In this case you can first install the dependencies for the application (`npm ci`), then start the application server (`npm start`) before calling `cypress-io/github-action` to install the dependencies for Cypress and to run Cypress. You may also need to use the [wait-on](#wait-on) parameter to make sure that the app server is fully available.
978
1078
 
979
1079
  ```yml
980
1080
  name: E2E
@@ -983,9 +1083,9 @@ jobs:
983
1083
  test:
984
1084
  runs-on: ubuntu-22.04
985
1085
  steps:
986
- - uses: actions/checkout@master
1086
+ - uses: actions/checkout@v4
987
1087
  - name: Install root dependencies
988
- uses: bahmutov/npm-install@v1
1088
+ run: npm ci
989
1089
 
990
1090
  - name: Start server in the background
991
1091
  run: npm start &
@@ -1000,6 +1100,7 @@ jobs:
1000
1100
  ### pnpm
1001
1101
 
1002
1102
  The package manager `pnpm` is not pre-installed in [GitHub Actions runner images](https://github.com/actions/runner-images) (unlike `npm` and `yarn`): to install `pnpm` include [pnpm/action-setup](https://github.com/pnpm/action-setup) in your workflow. If the action finds a `pnpm-lock.yaml` file, it uses the [pnpm](https://pnpm.io/cli/install) command `pnpm install --frozen-lockfile` by default to install dependencies.
1103
+ At this time the action does not automatically cache dependencies installed by pnpm. The example below includes steps to locate the pnpm store directory and to cache its contents for later use.
1003
1104
 
1004
1105
  ```yaml
1005
1106
  name: example-basic-pnpm
@@ -1009,11 +1110,22 @@ jobs:
1009
1110
  runs-on: ubuntu-22.04
1010
1111
  steps:
1011
1112
  - name: Checkout
1012
- uses: actions/checkout@v3
1113
+ uses: actions/checkout@v4
1013
1114
  - name: Install pnpm
1014
1115
  uses: pnpm/action-setup@v2
1015
1116
  with:
1016
1117
  version: 8
1118
+ - name: Get pnpm store directory
1119
+ shell: bash
1120
+ run: |
1121
+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
1122
+ - name: Setup pnpm cache
1123
+ uses: actions/cache@v4
1124
+ with:
1125
+ path: ${{ env.STORE_PATH }}
1126
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }}
1127
+ restore-keys: |
1128
+ ${{ runner.os }}-pnpm-store-
1017
1129
  - name: Cypress run
1018
1130
  uses: cypress-io/github-action@v6
1019
1131
  with:
@@ -1034,7 +1146,7 @@ jobs:
1034
1146
  runs-on: ubuntu-22.04
1035
1147
  steps:
1036
1148
  - name: Checkout
1037
- uses: actions/checkout@v3
1149
+ uses: actions/checkout@v4
1038
1150
  - name: Cypress run
1039
1151
  uses: cypress-io/github-action@v6
1040
1152
  with:
@@ -1055,7 +1167,7 @@ jobs:
1055
1167
  runs-on: ubuntu-22.04
1056
1168
  steps:
1057
1169
  - name: Checkout
1058
- uses: actions/checkout@v3
1170
+ uses: actions/checkout@v4
1059
1171
  - name: Cypress run
1060
1172
  uses: cypress-io/github-action@v6
1061
1173
  with:
@@ -1080,7 +1192,7 @@ jobs:
1080
1192
  runs-on: ubuntu-22.04
1081
1193
  steps:
1082
1194
  - name: Checkout
1083
- uses: actions/checkout@v3
1195
+ uses: actions/checkout@v4
1084
1196
  - name: Cypress run
1085
1197
  uses: cypress-io/github-action@v6
1086
1198
  with:
@@ -1109,7 +1221,7 @@ jobs:
1109
1221
  # and tests in a subfolder like "workspace-1"
1110
1222
  runs-on: ubuntu-22.04
1111
1223
  steps:
1112
- - uses: actions/checkout@v3
1224
+ - uses: actions/checkout@v4
1113
1225
  - uses: cypress-io/github-action@v6
1114
1226
  with:
1115
1227
  working-directory: examples/start-and-yarn-workspaces/workspace-1
@@ -1133,15 +1245,15 @@ jobs:
1133
1245
  # let's make sure our "app" works on several versions of Node
1134
1246
  strategy:
1135
1247
  matrix:
1136
- node: [18, 20]
1248
+ node: [18, 20, 21]
1137
1249
  name: E2E on Node v${{ matrix.node }}
1138
1250
  steps:
1139
1251
  - name: Setup Node
1140
- uses: actions/setup-node@v3
1252
+ uses: actions/setup-node@v4
1141
1253
  with:
1142
1254
  node-version: ${{ matrix.node }}
1143
1255
  - name: Checkout
1144
- uses: actions/checkout@v3
1256
+ uses: actions/checkout@v4
1145
1257
  # run Cypress tests and record them under the same run
1146
1258
  # associated with commit SHA and just give a different group name
1147
1259
  - name: Cypress run
@@ -1167,13 +1279,13 @@ jobs:
1167
1279
  runs-on: ubuntu-22.04
1168
1280
  strategy:
1169
1281
  matrix:
1170
- node: [18, 20]
1282
+ node: [18, 20, 21]
1171
1283
  name: E2E on Node v${{ matrix.node }}
1172
1284
  steps:
1173
- - uses: actions/setup-node@v3
1285
+ - uses: actions/setup-node@v4
1174
1286
  with:
1175
1287
  node-version: ${{ matrix.node }}
1176
- - uses: actions/checkout@v3
1288
+ - uses: actions/checkout@v4
1177
1289
  - uses: cypress-io/github-action@v6
1178
1290
  ```
1179
1291
 
@@ -1192,7 +1304,7 @@ jobs:
1192
1304
  test:
1193
1305
  runs-on: ubuntu-22.04
1194
1306
  steps:
1195
- - uses: actions/checkout@master
1307
+ - uses: actions/checkout@v4
1196
1308
  - name: Install dependencies
1197
1309
  uses: cypress-io/github-action@v6
1198
1310
  with:
@@ -1219,8 +1331,8 @@ Finally, you might not need this GH Action at all. For example, if you want to s
1219
1331
  If the project has many dependencies, but you want to install just Cypress you can combine this action with `actions/cache` and `npm i cypress` commands yourself.
1220
1332
 
1221
1333
  ```yml
1222
- - uses: actions/checkout@v3
1223
- - uses: actions/cache@v2
1334
+ - uses: actions/checkout@v4
1335
+ - uses: actions/cache@v4
1224
1336
  with:
1225
1337
  path: |
1226
1338
  ~/.cache/Cypress
@@ -1246,7 +1358,7 @@ jobs:
1246
1358
  # to prevent a hanging process from using all your CI minutes
1247
1359
  timeout-minutes: 10
1248
1360
  steps:
1249
- - uses: actions/checkout@v3
1361
+ - uses: actions/checkout@v4
1250
1362
  - uses: cypress-io/github-action@v6
1251
1363
  # you can specify individual step timeout too
1252
1364
  timeout-minutes: 5
@@ -1282,7 +1394,7 @@ See section [Yarn Modern](#yarn-modern) for information about using Yarn version
1282
1394
 
1283
1395
  This action uses the [debug](https://github.com/visionmedia/debug#readme) module to output additional verbose logs. You can see these debug messages by setting the following environment variable:
1284
1396
 
1285
- ```
1397
+ ```yml
1286
1398
  DEBUG: @cypress/github-action
1287
1399
  ```
1288
1400
 
@@ -1297,9 +1409,11 @@ You can set the environment variable using GitHub UI interface, or in the workfl
1297
1409
 
1298
1410
  See the [example-debug.yml](.github/workflows/example-debug.yml) workflow file.
1299
1411
 
1412
+ To collect more verbose GitHub Action logs you can set a GitHub secret or variable `ACTIONS_STEP_DEBUG` to `true`. This is useful to see detailed caching steps. See [Enabling debug logging](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging) from GitHub Actions documentation for more information.
1413
+
1300
1414
  ### Logs from the test runner
1301
1415
 
1302
- The above `ACTIONS_STEP_DEBUG` setting enables the debug logs from the action itself. To see the [Cypress debug logs](http://on.cypress.io/troubleshooting#Print-DEBUG-logs) add an environment variable to the action:
1416
+ To see the [Cypress debug logs](http://on.cypress.io/troubleshooting#Print-DEBUG-logs) add an environment variable to the action:
1303
1417
 
1304
1418
  ```yml
1305
1419
  - name: Cypress tests with debug logs
@@ -1353,14 +1467,12 @@ This is an example of using the step output `resultsUrl`:
1353
1467
  # let's give this action an ID so we can refer
1354
1468
  # to its output values later
1355
1469
  id: cypress
1356
- # Continue the build in case of an error, as we need to set the
1357
- # commit status in the next step, both in case of success or failure
1358
- continue-on-error: true
1359
1470
  with:
1360
1471
  record: true
1361
1472
  env:
1362
1473
  CYPRESS_RECORD_KEY: ${{ secrets.RECORDING_KEY }}
1363
1474
  - name: Print Cypress Cloud URL
1475
+ if: always()
1364
1476
  run: |
1365
1477
  echo Cypress finished with: ${{ steps.cypress.outcome }}
1366
1478
  echo See results at ${{ steps.cypress.outputs.resultsUrl }}
@@ -1386,7 +1498,7 @@ jobs:
1386
1498
  runs-on: ubuntu-22.04
1387
1499
  steps:
1388
1500
  - name: Checkout
1389
- uses: actions/checkout@v3
1501
+ uses: actions/checkout@v4
1390
1502
  - name: Cypress run
1391
1503
  uses: cypress-io/github-action@v6
1392
1504
  with:
@@ -1403,7 +1515,7 @@ jobs:
1403
1515
  runs-on: ubuntu-22.04
1404
1516
  steps:
1405
1517
  - name: Checkout
1406
- uses: actions/checkout@v3
1518
+ uses: actions/checkout@v4
1407
1519
  - name: Cypress install
1408
1520
  uses: cypress-io/github-action@v6
1409
1521
  with:
@@ -1434,75 +1546,62 @@ jobs:
1434
1546
  runs-on: ubuntu-22.04
1435
1547
  steps:
1436
1548
  - name: Checkout
1437
- uses: actions/checkout@v3
1549
+ uses: actions/checkout@v4
1438
1550
  - name: Cypress nightly tests 🌃
1439
1551
  uses: cypress-io/github-action@v6
1440
1552
  ```
1441
1553
 
1442
1554
  [![cron example](https://github.com/cypress-io/github-action/workflows/example-cron/badge.svg?branch=master)](.github/workflows/example-cron.yml)
1443
1555
 
1444
- ### Suppress test summary
1556
+ ### Job summary title
1445
1557
 
1446
- The default test summary can be suppressed by using the parameter `publish-summary` and setting its value to `false`.
1447
- Sometimes users want to publish test summary using a specific action.
1448
- 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.
1558
+ By default, the action produces a job summary in the GitHub Actions log for each workflow step where `github-action` is used. Each job summary shows a Passing / Failing status, the test counts for Passed, Failed, Pending & Skipped, followed by the Duration of the run. The job summaries are grouped by job.
1559
+
1560
+ To specify a title for a Job Summary, use the parameter `summary-title`. If no title is specified, then the default "Cypress Results" is used:
1449
1561
 
1450
1562
  ```yml
1451
- name: Example no summary
1563
+ name: Summary titles
1452
1564
  on: push
1453
1565
  jobs:
1454
- cypress-run:
1566
+ tests:
1455
1567
  runs-on: ubuntu-22.04
1456
1568
  steps:
1457
- - name: Checkout
1458
- uses: actions/checkout@v3
1459
- - name: Cypress run
1569
+ - uses: actions/checkout@v4
1570
+ - name: Cypress headless tests
1460
1571
  uses: cypress-io/github-action@v6
1461
1572
  with:
1462
- publish-summary: false
1573
+ summary-title: 'Headless'
1574
+ - name: Cypress headed tests
1575
+ uses: cypress-io/github-action@v6
1576
+ with:
1577
+ install: false
1578
+ headed: true
1579
+ summary-title: 'Headed'
1463
1580
  ```
1464
1581
 
1465
- ### Automatic PR number & URL detection
1582
+ The name of the GitHub Actions job is shown at the top of one or more job summaries from the same job. If multiple summaries belong to the same job, then giving them separate titles allows them to be uniquely identified.
1466
1583
 
1467
- When recording runs to Cypress Cloud, the PR number and URL can be automatically detected if you pass `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`
1468
- via the workflow `env`. When set, this value enables the Action to perform additional logic that grabs the related PR number and URL (if they
1469
- exist) and sets them in the environment variables `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
1470
- * See Cypress' documentation on [CI Build Information](https://on.cypress.io/guides/continuous-integration/introduction#CI-Build-Information)
1584
+ See the [example-chrome.yml](.github/workflows/example-chrome.yml) workflow, with multiple calls to `cypress-io/github-action` in one job, making use of the `summary-title` parameter. View the [example-chrome.yml - actions log](https://github.com/cypress-io/github-action/actions/workflows/example-chrome.yml) for an example of the resulting job summaries.
1585
+
1586
+ ### Suppress job summary
1587
+
1588
+ The default job summary can be suppressed by using the parameter `publish-summary` and setting its value to `false`.
1471
1589
 
1472
- Example workflow using the variables:
1473
1590
  ```yml
1474
- name: Example echo PR number and URL
1591
+ name: Example no summary
1475
1592
  on: push
1476
1593
  jobs:
1477
1594
  cypress-run:
1478
1595
  runs-on: ubuntu-22.04
1479
1596
  steps:
1480
1597
  - name: Checkout
1481
- uses: actions/checkout@v3
1598
+ uses: actions/checkout@v4
1482
1599
  - name: Cypress run
1483
1600
  uses: cypress-io/github-action@v6
1484
1601
  with:
1485
- record: true
1486
- - run: echo "PR number is $CYPRESS_PULL_REQUEST_ID"
1487
- - run: echo "PR URL is $CYPRESS_PULL_REQUEST_URL"
1488
- env:
1489
- CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
1490
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1602
+ publish-summary: false
1491
1603
  ```
1492
1604
 
1493
- #### Triggering event: `pull_request`/`pull_request_target`
1494
-
1495
- For either of these events, we set `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` to that of the PR number and URL, respectively, of the
1496
- PR that triggered the workflow.
1497
-
1498
- #### Triggering event: `push`
1499
-
1500
- When a commit on a branch without a PR is made, the Cypress GitHub Action checks to see if the commit that triggered the workflow has a
1501
- related PR. If the commit exists in any other PRs, it's considered a related PR. When there are related PRs, we grab the first related PR
1502
- and use that PR's number and URL for `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
1503
-
1504
- If no related PR is detected, `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` will be undefined.
1505
-
1506
1605
  ## Node.js
1507
1606
 
1508
1607
  ### Support
@@ -1529,8 +1628,8 @@ View the [CHANGELOG](./CHANGELOG.md) document for an overview of version changes
1529
1628
  ## Compatibility
1530
1629
 
1531
1630
  - `v6` is the current recommended version and uses `node20`
1532
- - `v5` uses `node16`
1533
- - `v4` is the minimum version required for Cypress `10.x` and later - also uses `node16`
1631
+ - `v5` uses the deprecated version `node16`
1632
+ - `v4` is the minimum version required for Cypress `10.x` and later - also uses the deprecated version `node16`
1534
1633
 
1535
1634
  Pay attention to any GitHub Actions deprecation warnings shown in logs which may recommend updating.
1536
1635
 
package/action.yml CHANGED
@@ -66,9 +66,12 @@ inputs:
66
66
  description: 'Whether or not to use headed mode'
67
67
  required: false
68
68
  publish-summary:
69
- description: 'Whether or not to publish job summary'
69
+ description: 'Whether or not to publish a job summary'
70
70
  required: false
71
71
  default: true
72
+ summary-title:
73
+ description: 'Title for job summary'
74
+ required: false
72
75
  spec:
73
76
  description: 'Provide a specific specs to run'
74
77
  required: false
package/dist/index.js CHANGED
@@ -74506,10 +74506,10 @@ const lockHash = () => {
74506
74506
  const lockFilename = useYarn()
74507
74507
  ? yarnFilename
74508
74508
  : usePnpm()
74509
- ? pnpmLockFilename
74510
- : useNpm()
74511
- ? packageLockFilename
74512
- : noLockFile()
74509
+ ? pnpmLockFilename
74510
+ : useNpm()
74511
+ ? packageLockFilename
74512
+ : noLockFile()
74513
74513
  const fileHash = hasha.fromFileSync(lockFilename)
74514
74514
  debug(`Hash from file ${lockFilename} is ${fileHash}`)
74515
74515
  return fileHash
@@ -75298,8 +75298,10 @@ const generateSummary = async (testResults) => {
75298
75298
  `${testResults.totalDuration / 1000}s` || ''
75299
75299
  ]
75300
75300
 
75301
+ const summaryTitle = core.getInput('summary-title')
75302
+
75301
75303
  await core.summary
75302
- .addHeading('Cypress Results', 2)
75304
+ .addHeading(summaryTitle ? summaryTitle : 'Cypress Results', 2)
75303
75305
  .addTable([headers, summaryRows])
75304
75306
  .addLink(
75305
75307
  testResults.runUrl ? 'View run in Cypress Cloud' : '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/github-action",
3
- "version": "6.5.0",
3
+ "version": "6.6.1",
4
4
  "description": "GitHub Action for running Cypress end-to-end and component tests",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -46,11 +46,11 @@
46
46
  "supports-color": "9.3.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/node": "20.5.9",
50
- "@vercel/ncc": "0.36.1",
49
+ "@types/node": "20.10.8",
50
+ "@vercel/ncc": "0.38.1",
51
51
  "husky": "8.0.3",
52
52
  "markdown-link-check": "3.11.1",
53
- "prettier": "3.0.3"
53
+ "prettier": "3.2.4"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"