You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Getting [PR and URL](#automatic-pr-number-and-url-detection) automatically
45
44
- Overwriting [Merge SHA into SHA](#merge-sha-into-sha) message
@@ -383,9 +382,13 @@ For more information, visit [the Cypress command-line docs](https://on.cypress.i
383
382
384
383
### Record test results on Cypress Cloud
385
384
386
-
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.
385
+
By setting the parameter `record` to `true`, you can record your test results into [Cypress Cloud](https://on.cypress.io/cloud). Read the [Cypress Cloud setup](https://on.cypress.io/cloud/get-started/setup) documentation to learn how to sign up to Cypress Cloud, to create and set up a [Cloud project](https://on.cypress.io/cloud/account-management/projects) to get the required `projectId` and record key for recording.
387
386
388
-
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.
387
+
- The `projectId` can either be stored in the [Cypress Configuration File](https://on.cypress.io/app/references/configuration#Configuration-File) or passed to the action as an environment variable `CYPRESS_PROJECT_ID`. In the example below, it is retrieved from a [GitHub secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) variable.
388
+
389
+
- The record key is passed to the action as an environment variable `CYPRESS_RECORD_KEY`. We recommend you treat this value as sensitive and store it as a [GitHub secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) variable, so that access is restricted.
390
+
391
+
- 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.
389
392
390
393
```yml
391
394
name: Cypress tests
@@ -403,40 +406,16 @@ jobs:
403
406
with:
404
407
record: true
405
408
env:
409
+
# pass the Cypress Cloud project ID as an environment variable or store it in the Cypress configuration file
To record the project needs `projectId` and `recordKey`.
415
-
416
-
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).
417
-
418
-
```yml
419
-
name: Cypress tests
420
-
on: push
421
-
jobs:
422
-
cypress-run:
423
-
name: Cypress run
424
-
runs-on: ubuntu-24.04
425
-
steps:
426
-
- name: Checkout
427
-
uses: actions/checkout@v4
428
-
429
-
- name: Cypress run
430
-
uses: cypress-io/github-action@v6
431
-
with:
432
-
record: true
433
-
env:
434
-
# pass the Cypress Cloud record key as an environment variable
# pass the project ID from the secrets through environment variable
437
-
CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }}
438
-
```
439
-
440
419
### Git information
441
420
442
421
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.
@@ -451,14 +430,14 @@ jobs:
451
430
steps:
452
431
- name: Checkout
453
432
uses: actions/checkout@v4
454
-
455
433
- name: Cypress run
456
434
uses: cypress-io/github-action@v6
457
435
with:
458
436
record: true
459
437
env:
460
438
# Get the short ref name of the branch that triggered the workflow run
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.
@@ -491,7 +470,7 @@ jobs:
491
470
- run: echo "PR number is $CYPRESS_PULL_REQUEST_ID"
0 commit comments