# Custom CI Build ID for Reruns

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="/files/GZ5RqYzyEG63BwroviNI" 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
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>
```

The question should be specific, self-contained, and written in natural language.
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.
