> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/getting-started/ci-setup/github-actions/re-run-failed-only-tests/custom-ci-build-id-for-reruns.md).

# Custom CI Build ID for Re-runs

How to configure custom CI build IDs for failed test reruns on GitHub Actions

The [Last Failed GitHub Action](https://github.com/currents-dev/playwright-last-failed) uses the default CI build ID pattern to fetch the previous run information:

`${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}`

When you use a custom [CI Build ID](/guides/parallelization-guide/ci-build-id.md) for your test runs, set `previous-ci-build-id` to match that custom pattern.

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2FSwrur2Aq7UwtVc6Wziom%2Fcustom-ci-build-id.png?alt=media&amp;token=e917d202-eea2-46ec-bb7d-35d80292a2cb" alt=""><figcaption><p>Using custom CI build ID for reruns</p></figcaption></figure>

## For Sharded Runs (with matrix strategy)

Use the matrix index and total to ensure each shard reruns its own failed tests:

{% code overflow="wrap" %}

```yaml

# an example for custom value like:
# currents-${{ github.run_id }}-${{ github.run_attempt }}
- name: Compute previous run attempt
  id: previous-attempt
  run: echo "previous=$(( ${{ github.run_attempt }} - 1 ))" >> "$GITHUB_OUTPUT"
- name: Playwright Last Failed action
  uses: currents-dev/playwright-last-failed@v2
  with:
    # if a custom CI build id is used, set "previous-ci-build-id" accordingly
    previous-ci-build-id: currents-${{ github.run_id }}-${{ steps.previous-attempt.outputs.previous }}
    pw-output-dir: basic/test-results
    matrix-index: ${{ matrix.shard }}
    matrix-total: ${{ strategy.job-total }}
```

{% endcode %}

## For Orchestrated Runs (Currents assigns tests across machines)

Omit the matrix parameters and use `or8n: true` so Currents handles test distribution:

{% code overflow="wrap" %}

```yaml
- name: Compute previous run attempt
  id: previous-attempt
  run: echo "previous=$(( ${{ github.run_attempt }} - 1 ))" >> "$GITHUB_OUTPUT"
- name: Playwright Last Failed action
  uses: currents-dev/playwright-last-failed@v2
  with:
    or8n: true
    previous-ci-build-id: currents-${{ github.run_id }}-${{ steps.previous-attempt.outputs.previous }}
    pw-output-dir: basic/test-results
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.currents.dev/getting-started/ci-setup/github-actions/re-run-failed-only-tests/custom-ci-build-id-for-reruns.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
