@cypress/github-action 6.6.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 +112 -58
- package/dist/index.js +4 -4
- package/package.json +3 -3
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
|
|
@@ -134,7 +138,7 @@ Alternatively, to mitigate unforeseen breaks, bind to a specific [tag](https://g
|
|
|
134
138
|
uses: cypress-io/github-action@v6.1.0
|
|
135
139
|
```
|
|
136
140
|
|
|
137
|
-
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 [
|
|
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.
|
|
138
142
|
|
|
139
143
|
### Browser
|
|
140
144
|
|
|
@@ -342,6 +346,8 @@ For more information, visit [the Cypress command-line docs](https://on.cypress.i
|
|
|
342
346
|
|
|
343
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.
|
|
344
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
|
+
|
|
345
351
|
```yml
|
|
346
352
|
name: Cypress tests
|
|
347
353
|
on: push
|
|
@@ -358,21 +364,17 @@ jobs:
|
|
|
358
364
|
with:
|
|
359
365
|
record: true
|
|
360
366
|
env:
|
|
361
|
-
# pass the Cypress Cloud record key as an environment variable
|
|
362
|
-
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
363
367
|
# pass GitHub token to allow accurately detecting a build vs a re-run build
|
|
364
368
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
365
369
|
```
|
|
366
370
|
|
|
367
371
|
[](.github/workflows/example-recording.yml)
|
|
368
372
|
|
|
369
|
-
|
|
373
|
+
### Project ID and Record Key
|
|
370
374
|
|
|
371
|
-
|
|
375
|
+
To record the project needs `projectId` and `recordKey`.
|
|
372
376
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
**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).
|
|
376
378
|
|
|
377
379
|
```yml
|
|
378
380
|
name: Cypress tests
|
|
@@ -392,12 +394,107 @@ jobs:
|
|
|
392
394
|
env:
|
|
393
395
|
# pass the Cypress Cloud record key as an environment variable
|
|
394
396
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
395
|
-
# pass GitHub token to allow accurately detecting a build vs a re-run build
|
|
396
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
397
397
|
# pass the project ID from the secrets through environment variable
|
|
398
398
|
CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }}
|
|
399
399
|
```
|
|
400
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
|
+
|
|
401
498
|
### Tag recordings
|
|
402
499
|
|
|
403
500
|
You can pass a single or multiple tags when recording a run. For example
|
|
@@ -485,14 +582,14 @@ jobs:
|
|
|
485
582
|
- uses: actions/checkout@v4
|
|
486
583
|
- uses: cypress-io/github-action@v6
|
|
487
584
|
# after the test run completes store videos and any screenshots
|
|
488
|
-
- uses: actions/upload-artifact@
|
|
585
|
+
- uses: actions/upload-artifact@v4
|
|
489
586
|
# add the line below to store screenshots only on failures
|
|
490
587
|
# if: failure()
|
|
491
588
|
with:
|
|
492
589
|
name: cypress-screenshots
|
|
493
590
|
path: cypress/screenshots
|
|
494
591
|
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
|
|
495
|
-
- uses: actions/upload-artifact@
|
|
592
|
+
- uses: actions/upload-artifact@v4
|
|
496
593
|
with:
|
|
497
594
|
name: cypress-videos
|
|
498
595
|
path: cypress/videos
|
|
@@ -1023,7 +1120,7 @@ jobs:
|
|
|
1023
1120
|
run: |
|
|
1024
1121
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
1025
1122
|
- name: Setup pnpm cache
|
|
1026
|
-
uses: actions/cache@
|
|
1123
|
+
uses: actions/cache@v4
|
|
1027
1124
|
with:
|
|
1028
1125
|
path: ${{ env.STORE_PATH }}
|
|
1029
1126
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('examples/basic-pnpm/pnpm-lock.yaml') }}
|
|
@@ -1235,7 +1332,7 @@ If the project has many dependencies, but you want to install just Cypress you c
|
|
|
1235
1332
|
|
|
1236
1333
|
```yml
|
|
1237
1334
|
- uses: actions/checkout@v4
|
|
1238
|
-
- uses: actions/cache@
|
|
1335
|
+
- uses: actions/cache@v4
|
|
1239
1336
|
with:
|
|
1240
1337
|
path: |
|
|
1241
1338
|
~/.cache/Cypress
|
|
@@ -1370,14 +1467,12 @@ This is an example of using the step output `resultsUrl`:
|
|
|
1370
1467
|
# let's give this action an ID so we can refer
|
|
1371
1468
|
# to its output values later
|
|
1372
1469
|
id: cypress
|
|
1373
|
-
# Continue the build in case of an error, as we need to set the
|
|
1374
|
-
# commit status in the next step, both in case of success or failure
|
|
1375
|
-
continue-on-error: true
|
|
1376
1470
|
with:
|
|
1377
1471
|
record: true
|
|
1378
1472
|
env:
|
|
1379
1473
|
CYPRESS_RECORD_KEY: ${{ secrets.RECORDING_KEY }}
|
|
1380
1474
|
- name: Print Cypress Cloud URL
|
|
1475
|
+
if: always()
|
|
1381
1476
|
run: |
|
|
1382
1477
|
echo Cypress finished with: ${{ steps.cypress.outcome }}
|
|
1383
1478
|
echo See results at ${{ steps.cypress.outputs.resultsUrl }}
|
|
@@ -1507,47 +1602,6 @@ jobs:
|
|
|
1507
1602
|
publish-summary: false
|
|
1508
1603
|
```
|
|
1509
1604
|
|
|
1510
|
-
### Automatic PR number & URL detection
|
|
1511
|
-
|
|
1512
|
-
When recording runs to Cypress Cloud, the PR number and URL can be automatically detected if you pass `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`
|
|
1513
|
-
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
|
|
1514
|
-
exist) and sets them in the environment variables `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
|
|
1515
|
-
* See Cypress' documentation on [CI Build Information](https://on.cypress.io/guides/continuous-integration/introduction#CI-Build-Information)
|
|
1516
|
-
|
|
1517
|
-
Example workflow using the variables:
|
|
1518
|
-
```yml
|
|
1519
|
-
name: Example echo PR number and URL
|
|
1520
|
-
on: push
|
|
1521
|
-
jobs:
|
|
1522
|
-
cypress-run:
|
|
1523
|
-
runs-on: ubuntu-22.04
|
|
1524
|
-
steps:
|
|
1525
|
-
- name: Checkout
|
|
1526
|
-
uses: actions/checkout@v4
|
|
1527
|
-
- name: Cypress run
|
|
1528
|
-
uses: cypress-io/github-action@v6
|
|
1529
|
-
with:
|
|
1530
|
-
record: true
|
|
1531
|
-
- run: echo "PR number is $CYPRESS_PULL_REQUEST_ID"
|
|
1532
|
-
- run: echo "PR URL is $CYPRESS_PULL_REQUEST_URL"
|
|
1533
|
-
env:
|
|
1534
|
-
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
|
1535
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
1536
|
-
```
|
|
1537
|
-
|
|
1538
|
-
#### Triggering event: `pull_request`/`pull_request_target`
|
|
1539
|
-
|
|
1540
|
-
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
|
|
1541
|
-
PR that triggered the workflow.
|
|
1542
|
-
|
|
1543
|
-
#### Triggering event: `push`
|
|
1544
|
-
|
|
1545
|
-
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
|
|
1546
|
-
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
|
|
1547
|
-
and use that PR's number and URL for `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
|
|
1548
|
-
|
|
1549
|
-
If no related PR is detected, `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL` will be undefined.
|
|
1550
|
-
|
|
1551
1605
|
## Node.js
|
|
1552
1606
|
|
|
1553
1607
|
### Support
|
package/dist/index.js
CHANGED
|
@@ -74506,10 +74506,10 @@ const lockHash = () => {
|
|
|
74506
74506
|
const lockFilename = useYarn()
|
|
74507
74507
|
? yarnFilename
|
|
74508
74508
|
: usePnpm()
|
|
74509
|
-
|
|
74510
|
-
|
|
74511
|
-
|
|
74512
|
-
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cypress/github-action",
|
|
3
|
-
"version": "6.6.
|
|
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.8
|
|
49
|
+
"@types/node": "20.10.8",
|
|
50
50
|
"@vercel/ncc": "0.38.1",
|
|
51
51
|
"husky": "8.0.3",
|
|
52
52
|
"markdown-link-check": "3.11.1",
|
|
53
|
-
"prettier": "3.
|
|
53
|
+
"prettier": "3.2.4"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|