diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 00000000..4623a3ad --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,5 @@ +{ + "enabledPlugins": { + "currents-skills@currents-internal-skills": true + } +} diff --git a/.gitbook.yaml b/.gitbook.yaml index 341ef0da..b2f3f822 100644 --- a/.gitbook.yaml +++ b/.gitbook.yaml @@ -1,50 +1,50 @@ root: ./ redirects: - api/api-keys: resources/api/api-keys.md + api/api-keys: dashboard/administration/api-keys.md ci-setup: getting-started/ci-setup/github-actions/README.md ci-setup/gitlab/playwright-gitlab-ci-cd: getting-started/ci-setup/gitlab/playwright-gitlab-ci-cd.md - ci-setup/azure-devops/playwright-azure-devops: getting-started/ci-setup/azure-devops/playwright-azure-devops.md - ci-setup/aws-code-build/playwright-aws-code-build: getting-started/ci-setup/aws-code-build/playwright-aws-code-build.md - ci-setup/circleci/playwright-circleci: getting-started/ci-setup/circleci/playwright-circleci.md + ci-setup/azure-devops/playwright-azure-devops: getting-started/ci-setup/playwright-azure-devops.md + ci-setup/aws-code-build/playwright-aws-code-build: getting-started/ci-setup/playwright-aws-code-build.md + ci-setup/circleci/playwright-circleci: getting-started/ci-setup/playwright-circleci.md ci-setup/github-actions/playwright-github-actions: getting-started/ci-setup/github-actions/playwright-github-actions.md - ci-setup/gitlab/cypress-gitlab-ci-cd: getting-started/ci-setup/gitlab/cypress-gitlab-ci-cd.md - ci-setup/bitbucket/cypress-bitbucket-pipelines: getting-started/ci-setup/bitbucket/cypress-bitbucket-pipelines.md - ci-setup/jenkins/jenkins-playwright: getting-started/ci-setup/jenkins/jenkins-playwright.md - ci-setup/aws-code-build/cypress-aws-code-build: getting-started/ci-setup/aws-code-build/cypress-aws-code-build.md + ci-setup/gitlab/cypress-gitlab-ci-cd: getting-started/other-frameworks/cypress/ci-setup/cypress-gitlab-ci-cd.md + ci-setup/bitbucket/cypress-bitbucket-pipelines: getting-started/other-frameworks/cypress/ci-setup/cypress-bitbucket-pipelines.md + ci-setup/jenkins/jenkins-playwright: getting-started/ci-setup/jenkins.md + ci-setup/aws-code-build/cypress-aws-code-build: getting-started/other-frameworks/cypress/ci-setup/cypress-aws-code-build.md ci-setup/nx: getting-started/ci-setup/nx.md ci-setup/github-actions/commit-data-for-github-actions: getting-started/ci-setup/github-actions/commit-data-for-github-actions.md - ci-setup/circleci/cypress-circleci: getting-started/ci-setup/circleci/cypress-circleci.md - ci-setup/jenkins/cypress-jenkins: getting-started/ci-setup/jenkins/cypress-jenkins.md - ci-setup/azure-devops/cypress-azure-devops: getting-started/ci-setup/azure-devops/cypress-azure-devops.md + ci-setup/circleci/cypress-circleci: getting-started/other-frameworks/cypress/ci-setup/cypress-circleci.md + ci-setup/jenkins/cypress-jenkins: getting-started/other-frameworks/cypress/ci-setup/cypress-jenkins.md + ci-setup/azure-devops/cypress-azure-devops: getting-started/other-frameworks/cypress/ci-setup/cypress-azure-devops.md administration/email-domain-based-access: dashboard/administration/email-domain-based-access.md - getting-started/you-first-cypress-run: getting-started/cypress/you-first-cypress-run.md - guides/parallelization: guides/parallelization-guide/cypress-parallelization.md - guides/pw-parallelization/playwright-orchestration: guides/parallelization-guide/pw-parallelization/playwright-orchestration.md + getting-started/you-first-cypress-run: getting-started/other-frameworks/cypress/you-first-cypress-run.md + guides/parallelization: guides/parallelization-guide/README.md + guides/pw-parallelization/playwright-orchestration: guides/ci-optimization/playwright-orchestration.md guides/ci-optimization/playwright-orchestration-v2: guides/ci-optimization/playwright-orchestration-v1.md - guides/pw-parallelization/playwright-sharding: guides/parallelization-guide/pw-parallelization/playwright-sharding.md - guides/load-balancing: guides/parallelization-guide/load-balancing.md - guides/fail-fast-strategy: guides/parallelization-guide/fail-fast-strategy.md + guides/pw-parallelization/playwright-sharding: guides/parallelization-guide/playwright-sharding.md + guides/load-balancing: guides/ci-optimization/load-balancing.md + guides/fail-fast-strategy: guides/ci-optimization/fail-fast-strategy.md insights/runs-analytics: dashboard/analytics/README.md tests/test-status: dashboard/tests/test-status.md tests/flaky-tests: dashboard/tests/flaky-tests.md - tests/spec-file-status: dashboard/tests/spec-file-status.md + tests/spec-file-status: dashboard/spec-file-status/README.md tests/test-history: dashboard/tests/test-history.md runs/run-timeouts: dashboard/runs/run-timeouts.md runs/run-details: dashboard/runs/run-details.md - runs/run-status: dashboard/runs/run-status.md + runs/run-status: dashboard/analytics/run-status.md runs/cancel-run: dashboard/runs/cancel-run.md runs/deleting-runs: dashboard/runs/deleting-runs.md resources/reporters/currents-playwright/pwc-p-orchestration: resources/reporters/currents-playwright/pwc-p.md - integration-with-playwright/currents-playwright: resources/reporters/currents-playwright.md - integration-with-playwright/playwright-component-testing: getting-started/playwright/integration-with-playwright/playwright-component-testing.md - integration-with-playwright/troubleshooting: getting-started/playwright/troubleshooting-playwright.md + integration-with-playwright/currents-playwright: resources/reporters/currents-playwright/README.md + integration-with-playwright/playwright-component-testing: guides/playwright-component-testing.md + integration-with-playwright/troubleshooting: guides/troubleshooting-playwright.md insights/insights-and-analytics: dashboard/analytics/README.md dashboard/insights-and-analytics: dashboard/analytics/README.md integrations/github/github-app: resources/integrations/github/github-app.md integrations/github/github-oauth: resources/integrations/github/github-oauth.md integrations/github: resources/integrations/github/README.md - integrations/slack: resources/integrations/slack.md + integrations/slack: resources/integrations/slack/README.md integrations/gitlab: resources/integrations/gitlab.md integrations/microsoft-teams: resources/integrations/microsoft-teams.md integrations/http-webhooks: resources/integrations/http-webhooks.md @@ -54,3 +54,17 @@ redirects: projects/archive-and-unarchive-projects: dashboard/projects/archive-and-unarchive-projects.md dashboard/billing-and-pricing: dashboard/billing/plans-and-pricing.md dashboard/administration/billing-and-usage: dashboard/billing/usage-and-spend-control.md + billing-and-pricing: dashboard/billing/plans-and-pricing.md + administration/billing-and-usage: dashboard/billing/usage-and-spend-control.md + dashboard/administration/team-management: dashboard/administration/manage-team.md + dashboard/runs/run-status: dashboard/analytics/run-status.md + getting-started/playwright: getting-started/your-first-playwright-run.md + guides/pw-parallelization: guides/ci-optimization/playwright-parallelization.md + guides/parallelization-guide/pw-parallelization: guides/ci-optimization/playwright-parallelization.md + guides/pw-parallelization/ci-tests-on-spot-instances: guides/ci-optimization/ci-tests-on-spot-instances.md + guides/playwright-rerun-failed-tests: guides/ci-optimization/re-run-only-failed-tests.md + getting-started/ci-setup/circleci: getting-started/ci-setup/playwright-circleci.md + getting-started/ci-setup/azure-devops: getting-started/ci-setup/playwright-azure-devops.md + getting-started/ci-setup/aws-code-build: getting-started/ci-setup/playwright-aws-code-build.md + getting-started/ci-setup/bitbucket: getting-started/other-frameworks/cypress/ci-setup/cypress-bitbucket-pipelines.md + getting-started/ci-setup/nx/playwright-nx: getting-started/ci-setup/nx.md diff --git a/SUMMARY.md b/SUMMARY.md index fd990253..dfea1e54 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -171,7 +171,7 @@ * [pwc-p discover](resources/reporters/currents-playwright/pwc-p-discover.md) * [pwc-p run](resources/reporters/currents-playwright/pwc-p-run.md) * [Playwright Fixtures](resources/reporters/currents-playwright/playwright-fixtures.md) - * [Changelog](https://github.com/currents-dev/currents-playwright/blob/main/CHANGELOG.md) + * [Changelog](https://github.com/currents-dev/currents-playwright-changelog/blob/main/CHANGELOG.md) * [@currents/cmd](resources/reporters/currents-cmd/README.md) * [currents api](resources/reporters/currents-cmd/currents-api.md) * [currents upload](resources/reporters/currents-cmd/currents-upload.md) diff --git a/dashboard/runs/cancel-run.md b/dashboard/runs/cancel-run.md index 815c3bea..1dc57b8c 100644 --- a/dashboard/runs/cancel-run.md +++ b/dashboard/runs/cancel-run.md @@ -110,20 +110,27 @@ The action also accepts an [api-keys.md](../administration/api-keys.md "mention" Pass `project-id` and `ci-build-id` as well to identify the run by its [ci-build-id.md](../../guides/parallelization-guide/ci-build-id.md "mention") instead — which is what you need when the workflow records under a CI build ID of its own: +Declare the variables on the job, not on the reporting step. A step's `env` is +visible only to that step, so the cancelling step reads them as empty: + ```yaml - - name: Run tests +jobs: + run-tests: + runs-on: ubuntu-latest env: CURRENTS_CI_BUILD_ID: "a-custom-ci-build-id" CURRENTS_PROJECT_ID: "my-project-id" - run: npx pwc --key ${{ secrets.CURRENTS_RECORD_KEY }} + steps: + - name: Run tests + run: npx pwc --key ${{ secrets.CURRENTS_RECORD_KEY }} - - name: Cancel the run if the workflow is cancelled - if: ${{ cancelled() }} - uses: currents-dev/cancel-run-gh-action@v1 - with: - api-token: ${{ secrets.CURRENTS_API_KEY }} - project-id: ${{ env.CURRENTS_PROJECT_ID }} - ci-build-id: ${{ env.CURRENTS_CI_BUILD_ID }} + - name: Cancel the run if the workflow is cancelled + if: ${{ cancelled() }} + uses: currents-dev/cancel-run-gh-action@v1 + with: + api-token: ${{ secrets.CURRENTS_API_KEY }} + project-id: ${{ env.CURRENTS_PROJECT_ID }} + ci-build-id: ${{ env.CURRENTS_CI_BUILD_ID }} ``` ## FAQ diff --git a/dashboard/runs/run-details.md b/dashboard/runs/run-details.md index 3aa0fa5b..327ef362 100644 --- a/dashboard/runs/run-details.md +++ b/dashboard/runs/run-details.md @@ -43,4 +43,4 @@ Currents collects additional information about the CI environment: | Browser / Project | Cypress tests browser or Playwright Project | | Author | Git commit author | | CI Build ID | [ci-build-id.md](../../guides/parallelization-guide/ci-build-id.md "mention") | -| CI Provider Link | Auto-detected or custom CI job/run URL. Set `CURRENTS_CI_URL` to override. See [https://github.com/currents-dev/currents-readme/blob/main/dashboard/reporters/currents-playwright/configuration.md](https://github.com/currents-dev/currents-readme/blob/main/dashboard/reporters/currents-playwright/configuration.md "mention") | +| CI Provider Link | Auto-detected or custom CI job/run URL. Set `CURRENTS_CI_URL` to override. See [configuration.md](../../resources/reporters/currents-playwright/configuration.md "mention") | diff --git a/getting-started/ci-setup/github-actions/cancel-runs.md b/getting-started/ci-setup/github-actions/cancel-runs.md index 28d13abe..4aa45eaf 100644 --- a/getting-started/ci-setup/github-actions/cancel-runs.md +++ b/getting-started/ci-setup/github-actions/cancel-runs.md @@ -32,7 +32,7 @@ The [cancel-run-gh-action](https://github.com/currents-dev/cancel-run-gh-action) uses: currents-dev/cancel-run-gh-action@v1 ``` -With no inputs it reads `CURRENTS_RECORD_KEY`, `CURRENTS_PROJECT_ID` and `CURRENTS_CI_BUILD_ID` from the environment the reporting step already sets. Like the command, it can also identify the run by its run id — the `run-id` input, or `CURRENTS_RUN_ID`. See the [action's README](https://github.com/currents-dev/cancel-run-gh-action#inputs) for every input. +With no inputs it reads `CURRENTS_RECORD_KEY`, `CURRENTS_PROJECT_ID` and `CURRENTS_CI_BUILD_ID` from the job's environment, the way the full example below declares them. Declare them on the reporting step instead and they arrive empty here, because a step's `env` is visible only to that step. Like the command, it can also identify the run by its run id — the `run-id` input, or `CURRENTS_RUN_ID`. See the [action's README](https://github.com/currents-dev/cancel-run-gh-action#inputs) for every input. ## Full example diff --git a/getting-started/ci-setup/playwright-circleci.md b/getting-started/ci-setup/playwright-circleci.md index ffa6117f..3aa66aa6 100644 --- a/getting-started/ci-setup/playwright-circleci.md +++ b/getting-started/ci-setup/playwright-circleci.md @@ -10,18 +10,18 @@ TL;DR Check out the example repository: [https://github.com/currents-dev/currents-examples](https://github.com/currents-dev/currents-examples/tree/main/playwright/ci/circleci) {% endhint %} -Run Playwright tests in [parallel on CircleCI](https://circleci.com/docs/2.0/parallelism-faster-jobs/) using the native [Playwright Sharding](https://playwright.dev/docs/test-sharding) to split the tests between multiple containers. Parallelizing the test will help in decreasing the overall run duration. +Run Playwright tests in [parallel on CircleCI](https://circleci.com/docs/guides/optimize/parallelism-faster-jobs/) using the native [Playwright Sharding](https://playwright.dev/docs/test-sharding) to split the tests between multiple containers. Parallelizing the test will help in decreasing the overall run duration. Currents collects the results of distributed parallel CircleCI builds for more efficient troubleshooting. Each container will receive a unique set of tests to run so that your tests will run faster and you can receive faster feedback from your browser test suite. -Create multiple containers that will run your tests in parallel by setting the desired amount of containers with [`parallelism`](https://circleci.com/docs/2.0/configuration-reference/#parallelism) flag in `config.yaml` file. +Create multiple containers that will run your tests in parallel by setting the desired amount of containers with the [`parallelism`](https://circleci.com/docs/reference/configuration-reference/#parallelism) key in the `.circleci/config.yml` file. Please refer to the [example repository](https://github.com/currents-dev/currents-examples/tree/main/playwright/ci/circleci) demonstrating how to set up [CircleCI](https://circleci.com) for running Playwright tests in parallel using [Currents](https://currents.dev) service. * Create an organization at https://app.currents.dev * Create a new project * Grab `CURRENTS_RECORD_KEY` [record-key.md](../../guides/record-key.md "mention") and `CURRENTS_PROJECT_ID` -* Store `CURRENTS_RECORD_KEY`: [https://circleci.com/docs/contexts/](https://circleci.com/docs/contexts/) +* Store `CURRENTS_RECORD_KEY`: [https://circleci.com/docs/guides/security/contexts/](https://circleci.com/docs/guides/security/contexts/)
# .circleci/config.yml
 version: 2.1
diff --git a/getting-started/ci-setup/playwright-harness.md b/getting-started/ci-setup/playwright-harness.md
index 170d5594..88c490a9 100644
--- a/getting-started/ci-setup/playwright-harness.md
+++ b/getting-started/ci-setup/playwright-harness.md
@@ -4,7 +4,7 @@ description: Running Playwright tests on Harness CI with Currents reporting and
 
 # Harness
 
-This guide explains how to run Playwright tests on [Harness Continuous Integration](https://developer.harness.io/docs/category/set-up-cicd-pipelines) and report results to [Currents](https://currents.dev). It follows Harness NextGen pipeline patterns ([Run steps](https://developer.harness.io/docs/continuous-integration/use-ci/run-step-settings), [stage parallelism](https://developer.harness.io/docs/continuous-integration/use-ci/run-tests/speed-up-ci-test-pipelines-using-parallelism), [secrets](https://developer.harness.io/docs/platform/secrets/add-use-text-secrets)).
+This guide explains how to run Playwright tests on [Harness Continuous Integration](https://developer.harness.io/docs/continuous-integration/) and report results to [Currents](https://currents.dev). It follows Harness NextGen pipeline patterns ([Run steps](https://developer.harness.io/docs/continuous-integration/use-ci/run-step-settings), [stage parallelism](https://developer.harness.io/docs/continuous-integration/use-ci/run-tests/speed-up-ci-test-pipelines-using-parallelism), [secrets](https://developer.harness.io/docs/platform/secrets/add-use-text-secrets)).
 
 {% hint style="warning" %}
 **`CURRENTS_CI_BUILD_ID` is mandatory** for Harness. Harness is **not** in Currents’ [auto-detected CI providers](../../guides/parallelization-guide/ci-build-id.md#build-id-for-popular-ci-providers). If you omit it, Currents may generate a **different** build ID per job or shard: parallel Playwright shards **will not merge into one run**, reporting and orchestration **break**, and **retries** can collide with or duplicate prior runs. Always set `CURRENTS_CI_BUILD_ID` in every Run step (see below).
diff --git a/getting-started/other-frameworks/cypress/ci-setup/cypress-circleci.md b/getting-started/other-frameworks/cypress/ci-setup/cypress-circleci.md
index ba043b04..0b40803d 100644
--- a/getting-started/other-frameworks/cypress/ci-setup/cypress-circleci.md
+++ b/getting-started/other-frameworks/cypress/ci-setup/cypress-circleci.md
@@ -21,9 +21,9 @@ The example [config file](https://github.com/currents-dev/currents-examples/blob
 * Create an account at https:/app.currents.dev.
 * Obtain **ProjectId** and **Record Key**.
 * Set `CURRENTS_RECORD_KEY`:
-  * create [CircleCI context](https://circleci.com/docs/contexts/) and set `CURRENTS_RECORD_KEY`.
-  * alternatively, set [Environment variable](https://circleci.com/docs/2.0/env-vars/) `CURRENTS_RECORD_KEY`
-* Follow the setup instructions at [https://currents.dev/readme/integration-with-cypress/cypress-cloud](https://currents.dev/readme/integration-with-cypress/cypress-cloud) to create `currents.config.js` set your `projectId`
+  * create [CircleCI context](https://circleci.com/docs/guides/security/contexts/) and set `CURRENTS_RECORD_KEY`.
+  * alternatively, set [Environment variable](https://circleci.com/docs/guides/security/env-vars/) `CURRENTS_RECORD_KEY`
+* Follow the setup instructions at [cypress-cloud](../../../../resources/reporters/cypress-cloud/README.md "mention") to create `currents.config.js` set your `projectId`
 
 ### Bare CircleCI configuration
 
diff --git a/guides/playwright-visual-testing.md b/guides/playwright-visual-testing.md
index 65717eed..036fcb17 100644
--- a/guides/playwright-visual-testing.md
+++ b/guides/playwright-visual-testing.md
@@ -222,5 +222,5 @@ function assertEnvVariable(name: string) {
 
 You can use the same concept to send a "finalize" command to other visual testing tools like Applitools and Percy.
 
-* Applitools - refer to [Closing the Batch](https://applitools.com/tutorials/guides/advanced-use-cases/parallel-test-suites#step-3-closing-the-batch) section the Parallel Test Suites guide
+* Applitools - refer to [Closing the Batch](https://applitools.com/docs/eyes/concepts/test-execution/parallel-test-suites#step-3-closing-the-batch) section the Parallel Test Suites guide
 * Percy - refer to `percy build:finalize` step in [Percy documentation](https://www.browserstack.com/docs/percy/integrate/parallel-test-suites)
diff --git a/resources/changelog.md b/resources/changelog.md
index 5246f5de..55d310eb 100644
--- a/resources/changelog.md
+++ b/resources/changelog.md
@@ -6,7 +6,7 @@ icon: square-rss
 # Changelog
 
 * [Changelog](https://changelog.currents.dev/changelog) - main platform updates and improvements 
-* [@currents/playwright](https://github.com/currents-dev/currents-playwright/blob/main/CHANGELOG.md) - Playwright reporter for Currents changelog
+* [@currents/playwright](https://github.com/currents-dev/currents-playwright-changelog/blob/main/CHANGELOG.md) - Playwright reporter for Currents changelog
 * [@currents/cmd](https://github.com/currents-dev/currents-reporter/blob/main/packages/cmd/CHANGELOG.md) - CLI utilities and generic XML reporter for Currents changelog
 * [@currents/jest](https://github.com/currents-dev/currents-reporter/blob/main/packages/jest/CHANGELOG.md) - Jest reporter for Currents changelog
 * [@currents/node-test-reporter](https://github.com/currents-dev/currents-reporter/blob/main/packages/node-test-reporter/CHANGELOG.md) - NodeJS Test Runner reporter for Currents changelog
diff --git a/resources/integrations/slack/slack-app.md b/resources/integrations/slack/slack-app.md
index 3763dc1c..cf7a84da 100644
--- a/resources/integrations/slack/slack-app.md
+++ b/resources/integrations/slack/slack-app.md
@@ -360,7 +360,7 @@ Both [Annotation-Based Mentions](#annotation-based-mentions) and [UI-Based Menti
 | **Multiple Mentions** | Comma-separated combination of formats      | `user:U01RWNBFGER, team:S07JCUP81EG, miguel@currents.dev` |
 
 {% hint style="info" %}
-**Finding Slack IDs:** See [Slack's documentation](https://slack.com/help/articles/360057541954-Get-user-and-group-IDs) for instructions on finding user and group IDs.
+**Finding Slack IDs:** See [Slack's documentation](https://slack.com/help/articles/221769328-Locate-your-Slack-URL-or-ID) for instructions on finding user and group IDs.
 {% endhint %}
 
 ## Automated Reports to Slack
diff --git a/resources/reporters/currents-cmd/currents-cancel.md b/resources/reporters/currents-cmd/currents-cancel.md
index c62d1a09..e328dff2 100644
--- a/resources/reporters/currents-cmd/currents-cancel.md
+++ b/resources/reporters/currents-cmd/currents-cancel.md
@@ -4,13 +4,13 @@ description: Learn how to cancel a run from CI using the currents cancel CLI com
 
 # currents cancel
 
-`currents cancel` cancels a run that is still in progress, for example when the CI job that recorded it is cancelled.
+`currents cancel` cancels a run that is still in progress, for example when you stop the associated CI job.
 
 A cancelled CI job stops reporting mid-run, so without an explicit cancellation the run stays in progress until it hits the project's [run-timeouts.md](../../../dashboard/runs/run-timeouts.md "mention").
 
-The command is available from `@currents/cmd` 1.10.0. `npx currents` resolves the latest version, so no change is needed unless the version is pinned.
+The command is available from `@currents/cmd` 1.10.0.
 
-### Usage
+## Usage
 
 {% hint style="info" %}
 The command authenticates with the [record-key.md](../../../guides/record-key.md "mention") the job already uses to report results — no API key is needed. It accepts `--key`, `--project-id`, `--ci-build-id` and `--run-id`, or the `CURRENTS_RECORD_KEY`, `CURRENTS_PROJECT_ID`, `CURRENTS_CI_BUILD_ID` and `CURRENTS_RUN_ID` environment variables.
@@ -20,7 +20,7 @@ The command authenticates with the [record-key.md](../../../guides/record-key.md
 npx currents cancel --key  --project-id  --ci-build-id 
 ```
 
-### Identifying the run
+## Identifying the run
 
 Pass either the [ci-build-id.md](../../../guides/parallelization-guide/ci-build-id.md "mention") the run was recorded with, or the run id:
 
@@ -35,49 +35,67 @@ Use `--ci-build-id` for cancelling from CI. Set `CURRENTS_CI_BUILD_ID` on the jo
 Use `--run-id` when you already have the run id: it is the last segment of the run URL, `https://app.currents.dev/run/`. This is the option for cancelling a specific run from a script or by hand.
 
 {% hint style="warning" %}
-If the job does not set `CURRENTS_CI_BUILD_ID`, Currents generates a CI build id from the CI environment, and the generated value includes the test framework — for example `pw:owner/repo-16873-1`. A cancelling step that rebuilds the CI build id from environment variables will not produce that string and will report that there is no run to cancel. Set `CURRENTS_CI_BUILD_ID` explicitly on any job you want to cancel from CI.
+Set `CURRENTS_CI_BUILD_ID` on any job you want to cancel from CI. Without it, Currents generates the value from the CI environment, or at random on a provider it does not detect. `currents cancel` cannot reproduce either form, so the command reports that there is no run to cancel.
 {% endhint %}
 
-### Cancelling from GitHub Actions
+## Cancelling from GitHub Actions
 
-A job that already exports the record key, project and CI build id needs no arguments:
+A job that already exports the record key, project and CI Build ID needs no arguments:
 
 ```yaml
-- name: Run tests
-  env:
-    CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
-    CURRENTS_PROJECT_ID: my-project-id
-    CURRENTS_CI_BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
-  run: npx playwright test
-
-- name: Cancel the run if the workflow is cancelled
-  if: ${{ cancelled() }}
-  env:
-    CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
-    CURRENTS_PROJECT_ID: my-project-id
-    CURRENTS_CI_BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
-  run: npx currents cancel
+jobs:
+  run-tests:
+    runs-on: ubuntu-latest
+    env:
+      CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
+      CURRENTS_PROJECT_ID: my-project-id
+      CURRENTS_CI_BUILD_ID: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
+    steps:
+      - name: Run tests
+        run: npx playwright test
+
+      - name: Cancel the run if the workflow is cancelled
+        if: ${{ cancelled() }}
+        run: npx currents cancel
 ```
 
-### Cancelling from other CI providers
+Declaring them on the job is what lets the cancel step run with no arguments. A step's `env` is visible only to that step.
 
-The command only needs the record key, the project and the CI build id, so the same step works anywhere. Set the CI build id for the whole pipeline, so the job that reports and the job that cancels use the same value. GitLab CI, for example:
+The snippet above is trimmed to the parts that matter for cancelling. [cancel-runs.md](../../../getting-started/ci-setup/github-actions/cancel-runs.md "mention") holds the complete workflow, including checkout, setup and `concurrency`. Change that page when the workflow itself changes.
+
+## Cancelling from other CI providers
+
+The command only needs the record key, the project and the CI Build ID, so the same step works anywhere. Set the CI Build ID for the whole pipeline, so the reporting job and the cancelling step use the same value. GitLab CI, for example:
 
 ```yaml
 variables:
   CURRENTS_CI_BUILD_ID: $CI_PIPELINE_ID
 
-cancel_currents_run:
-  stage: .post
-  when: on_failure
+playwright_tests:
   script:
-    - npx currents cancel
+    - npx playwright test
+  after_script:
+    - if [ "$CI_JOB_STATUS" = "canceled" ]; then npx currents cancel; fi
 ```
 
-`CURRENTS_RECORD_KEY` and `CURRENTS_PROJECT_ID` come from the pipeline's variables, the same ones the reporting job uses.
+`CURRENTS_RECORD_KEY` and `CURRENTS_PROJECT_ID` come from the pipeline's variables, the same ones the reporting job uses. Set `CURRENTS_RECORD_KEY` as a masked CI/CD variable, and protected where your branch policy allows it. Masking keeps the key out of the job log. `CURRENTS_PROJECT_ID` is not a secret and needs neither.
+
+The guard relies on GitLab running `after_script` on cancellation. No `when:` value matches a cancelled job, including `when: on_failure`, which fires only on failure.
+
+Cancelling from `after_script` requires GitLab 17.0 with GitLab Runner 16.11.1, the first versions where `$CI_JOB_STATUS` reads `canceled`. Runner 16.10 runs `after_script` on cancellation but reports `failed`, so the guard never matches.
+
+Two cases skip `after_script` on any version: a job cancelled while still pending, and a force cancelled job. Those runs end at the [run-timeouts.md](../../../dashboard/runs/run-timeouts.md "mention") instead.
+
+{% hint style="warning" %}
+A CI Build ID has to stay the same across every job in a pipeline, and `$CI_PIPELINE_ID` does. Retrying a single job does not change the value. Currents requires a distinct CI Build ID per attempt, so a retried job reports against the completed run instead of a new one.
+
+Whatever value you pick, set it in `variables:` as above. Both `script` and `after_script` read `CURRENTS_CI_BUILD_ID` from the job's environment. Add the discriminator to the reporting command alone and `currents cancel` looks for a different run than the one you recorded.
+
+If a single job reports the whole run, use `$CI_JOB_ID`, which changes on every retry. If the run is split across parallel jobs, no GitLab variable is both per-attempt and shared by all of them. Re-run the pipeline instead, so the jobs get a new `$CI_PIPELINE_ID`. See [ci-build-id.md](../../../guides/parallelization-guide/ci-build-id.md "mention").
+{% endhint %}
 
-### Notes
+## Notes
 
-* Every job of a parallelized run records into the same run. Cancelling a run that is already cancelled succeeds, so it is safe for each job to run the command.
-* A run only exists once results have been recorded. Cancelling before the first results were uploaded reports that there is no run to cancel and exits successfully, so the step does not fail on an already cancelled job.
-* Cancelled runs are marked in the dashboard and trigger the usual integrations. See [cancel-run.md](../../../dashboard/runs/cancel-run.md "mention") for what cancelling a run affects.
+- Every job of a parallelized run records into the same run. Cancelling a run that is already cancelled succeeds, so it is safe for each job to run the command.
+- A run only exists once results have been recorded. Cancelling before the first results were uploaded reports that there is no run to cancel and exits successfully, so the step does not fail on an already cancelled job.
+- Cancelled runs are marked in the dashboard and trigger the usual integrations. See [cancel-run.md](../../../dashboard/runs/cancel-run.md "mention") for what cancelling a run affects.