> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testdino.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Playwright re-runs in GitHub Actions

> Add TestDino's re-run inputs to a GitHub Actions workflow so the Re-run button can start it with only the failed or flaky Playwright tests.

Declare TestDino's re-run inputs on a GitHub Actions workflow so the **Re-run** button on a test run can start that workflow with the selected test cases. Learn how to start a re-run in [Re-run failed Playwright tests](https://docs.testdino.com/guides/debug-playwright-failures/rerun-failed-tests.md).

## When you need these inputs

A **This commit** re-run of a test run from GitHub Actions, scoped to **Failed** or **Both**, re-runs the failed jobs inside the original GitHub run. It needs no workflow inputs.

Every other re-run starts a new workflow run and needs the inputs on this page:

* **Latest on `<branch>`**
* The **Flaky** scope, and a **Custom** selection that leaves out a failed test case
* A test run that did not come from GitHub Actions, or that GitHub can no longer re-run (in progress, or older than 30 days)

## Prerequisites

* GitHub connected to the project in Project settings, under Integrations, with the TestDino GitHub App allowed to start workflows.
* `@testdino/playwright` 2.7.0 or later and Playwright 1.56 or later in the repository. **Extra tags** need 2.7.6 or later.
* A workflow that runs your tests with `npx tdpw test`.

## Set up with an AI agent

Paste this prompt into your coding agent, or follow the manual steps below.

Add TestDino re-run inputs to the GitHub Actions workflow that runs Playwright.

Add TestDino re-run support to the GitHub Actions workflow in this repository that runs Playwright tests.

**Preserve the existing workflow**

* Edit the existing Playwright workflow in place. Do not replace it with a generic example.
* Keep every existing trigger, branch and path filter, job, matrix, cache, environment variable, and secret. Add workflow\_dispatch next to the existing triggers.
* A push or pull request run must execute exactly the same command as before.

**Changes**

* Declare these workflow\_dispatch inputs, each with type: string: testdino\_rerun\_from (required: true), testdino\_rerun\_scope (default: failed), testdino\_rerun\_test\_ids, testdino\_rerun\_exclude\_ids, testdino\_rerun\_sha, testdino\_rerun\_tags (all required: false).
* In actions/checkout, set `ref: ${{ inputs.testdino_rerun_sha || github.sha }}`. If checkout already sets a ref, use that value as the fallback instead of github.sha. Keep the other checkout options, such as fetch-depth.
* Replace npx playwright test with npx tdpw test and keep the existing Playwright arguments. Keep TESTDINO\_TOKEN from secrets.
* Pass each input to the test step as an env var. Never put an expression directly in the shell script.
* Only when testdino\_rerun\_from is non-empty, add `--rerun <scope> --from-run <id>`, plus --test-ids, --exclude-ids, and --rerun-tags when those inputs are non-empty.
* On a re-run, drop any --shard, --grep, --grep-invert, --last-failed, --test-list, --test-list-invert, and --split arguments. tdpw refuses them together with --rerun.
* Set @testdino/playwright to 2.7.8 or later in package.json and update the lockfile with the repository's package manager.

**Verify**

* Validate the workflow YAML, with actionlint if it is available.
* Show the final test command for a push run and for a re-run, and confirm the push command matches the original.
* Do not run tests, commit, or push. Reply with the files you changed, a short summary, and the diff.

Docs: [https://docs.testdino.com/guides/debug-playwright-failures/configure-reruns-github-actions.md](https://docs.testdino.com/guides/debug-playwright-failures/configure-reruns-github-actions.md)

## Add the re-run inputs

TestDino offers any active workflow on the test run's branch that declares a `testdino_rerun_from` input. Either shape works:

| Choice | Pick it when |
| :- | :- |
| **Existing workflow** | You want 1 workflow definition to maintain. It keeps its normal triggers and gains a re-run path. |
| **Separate workflow** | You want re-runs isolated: their own logs, their own concurrency, no change to the workflow CI already runs. |

> [tab] Existing workflow
>
> Add `workflow_dispatch` and the inputs to the workflow you already run Playwright with. The `if [ -n "$TD_RERUN_FROM" ]` guard keeps a normal push unchanged: on a push the input is empty, so no re-run arguments are added.
>
> ```yaml .github/workflows/playwright.yml theme={null}
> on:
>   push:
>   workflow_dispatch:
>     inputs:
>       testdino_rerun_from:
>         required: true
>       testdino_rerun_scope:
>         default: failed
>       testdino_rerun_test_ids:
>         required: false
>       testdino_rerun_exclude_ids:
>         required: false
>       testdino_rerun_sha:
>         required: false
>       testdino_rerun_tags:
>         required: false
>
> jobs:
>   test:
>     runs-on: ubuntu-latest
>     steps:
>       - uses: actions/checkout@v4
>         with:
>           ref: ${{ inputs.testdino_rerun_sha || github.sha }}
>       - uses: actions/setup-node@v4
>         with:
>           node-version: 22
>       - run: npm ci
>       - name: Run tests
>         env:
>           TESTDINO_TOKEN: ${{ secrets.TESTDINO_TOKEN }}
>           TD_RERUN_FROM: ${{ inputs.testdino_rerun_from }}
>           TD_RERUN_SCOPE: ${{ inputs.testdino_rerun_scope }}
>           TD_RERUN_TEST_IDS: ${{ inputs.testdino_rerun_test_ids }}
>           TD_RERUN_EXCLUDE_IDS: ${{ inputs.testdino_rerun_exclude_ids }}
>           TD_RERUN_TAGS: ${{ inputs.testdino_rerun_tags }}
>         shell: bash
>         run: |
>           args=()
>           if [ -n "$TD_RERUN_FROM" ]; then
>             args+=(--rerun "${TD_RERUN_SCOPE:-failed}" --from-run "$TD_RERUN_FROM")
>             if [ -n "$TD_RERUN_TEST_IDS" ]; then
>               args+=(--test-ids "$TD_RERUN_TEST_IDS")
>             fi
>             if [ -n "$TD_RERUN_EXCLUDE_IDS" ]; then
>               args+=(--exclude-ids "$TD_RERUN_EXCLUDE_IDS")
>             fi
>             if [ -n "$TD_RERUN_TAGS" ]; then
>               args+=(--rerun-tags "$TD_RERUN_TAGS")
>             fi
>           fi
>           npx tdpw test "${args[@]}"
> ```

> [tab] Separate workflow
>
> A workflow that only runs re-runs needs no guard: `workflow_dispatch` is its only trigger and `testdino_rerun_from` is required, so the input is always present.
>
> ```yaml .github/workflows/rerun.yml theme={null}
> name: Re-run failed tests
>
> on:
>   workflow_dispatch:
>     inputs:
>       testdino_rerun_from:
>         required: true
>       testdino_rerun_scope:
>         default: failed
>       testdino_rerun_test_ids:
>         required: false
>       testdino_rerun_exclude_ids:
>         required: false
>       testdino_rerun_sha:
>         required: false
>       testdino_rerun_tags:
>         required: false
>
> jobs:
>   test:
>     runs-on: ubuntu-latest
>     steps:
>       - uses: actions/checkout@v4
>         with:
>           ref: ${{ inputs.testdino_rerun_sha || github.sha }}
>       - uses: actions/setup-node@v4
>         with:
>           node-version: 22
>       - run: npm ci
>       - name: Run the selected tests
>         env:
>           TESTDINO_TOKEN: ${{ secrets.TESTDINO_TOKEN }}
>           TD_RERUN_FROM: ${{ inputs.testdino_rerun_from }}
>           TD_RERUN_SCOPE: ${{ inputs.testdino_rerun_scope }}
>           TD_RERUN_TEST_IDS: ${{ inputs.testdino_rerun_test_ids }}
>           TD_RERUN_EXCLUDE_IDS: ${{ inputs.testdino_rerun_exclude_ids }}
>           TD_RERUN_TAGS: ${{ inputs.testdino_rerun_tags }}
>         shell: bash
>         run: |
>           args=(--rerun "${TD_RERUN_SCOPE:-failed}" --from-run "$TD_RERUN_FROM")
>           if [ -n "$TD_RERUN_TEST_IDS" ]; then
>             args+=(--test-ids "$TD_RERUN_TEST_IDS")
>           fi
>           if [ -n "$TD_RERUN_EXCLUDE_IDS" ]; then
>             args+=(--exclude-ids "$TD_RERUN_EXCLUDE_IDS")
>           fi
>           if [ -n "$TD_RERUN_TAGS" ]; then
>             args+=(--rerun-tags "$TD_RERUN_TAGS")
>           fi
>           npx tdpw test "${args[@]}"
> ```

The workflow file must be on the test run's branch. A workflow that exists only on another branch cannot run the re-run, and the panel names it under the workflow picker.

The same workflow can also declare the `testdino_selection` input, which **Run automation** in Test Management uses. In that workflow, set `testdino_rerun_from` to `required: false`, or GitHub refuses to start it from **Run automation**. See [Run automated tests](https://docs.testdino.com/test-management/run-automated-tests.md#set-up-your-workflow).

## Workflow inputs

| Input | Required? | Without it |
| :- | :- | :- |
| `testdino_rerun_from` | Yes | The workflow is not offered for re-runs. |
| `testdino_rerun_scope` | Recommended | Only **Failed** can be sent. |
| `testdino_rerun_test_ids` and `testdino_rerun_exclude_ids` | Both, for **Custom** | A hand-picked selection cannot be sent, and the panel says so. |
| `testdino_rerun_sha` | For **This commit** | Only **Latest** can be sent. |
| `testdino_rerun_tags` | For **Extra tags** | Tags cannot be added with this workflow. |

## Pin a same-commit re-run

> [!WARNING]
>
> Pass `testdino_rerun_sha` to `actions/checkout` as `ref:`, as in both examples above. A workflow that declares the input without using it reports a **This commit** re-run while it runs the latest code on the branch.

GitHub uses the workflow file from the latest commit on the branch. A **This commit** re-run therefore runs the original test code under your current workflow configuration.

## Run only the failed test cases in each job

This section applies to a **This commit** re-run inside the original GitHub run. Each retried job runs only the test cases that failed in it when the job runs `npx tdpw test` with `@testdino/playwright` 2.7.8 or later. Your job's command stays the same.

Otherwise every test case in the failed jobs runs again. The button reads `Re-run failed jobs in full`, the panel shows **Every test in the failed jobs will run again** with the change to make, and the job log line that starts with `TestDino: running the full command on this GitHub retry` gives the reason.

| Case | What to do |
| :- | :- |
| The workflow runs `npx playwright test` | Switch the command to `npx tdpw test`. |
| `@testdino/playwright` is older than 2.7.8 | Update the package. |
| A test case in the job has no result from the earlier attempt, after a cancelled shard, a crashed job, or a time-out | Nothing to do. The whole job runs. |
| The same Playwright project runs in more than 1 job, such as an operating system or Node version matrix | Nothing to do. A browser matrix built from Playwright projects is unaffected. |
| The re-run was started from GitHub's own **Re-run failed jobs** button | Start the re-run from TestDino instead. |

## Troubleshooting

> [accordion] No workflow is offered in the panel
>
> No active workflow on the branch declares a `testdino_rerun_from` input, or the TestDino GitHub App cannot start workflows. Add the inputs as shown in [Add the re-run inputs](#add-the-re-run-inputs). Until then, **Run manually** in the panel gives the terminal command.

> [accordion] This commit is unavailable
>
> The panel shows 1 of these reasons:
>
> * `The run recorded no commit to pin to.`
> * `The run recorded an abbreviated commit, which cannot be pinned.`
> * `This workflow does not declare the testdino_rerun_sha input, so it cannot check out a specific commit.`
>
> For the last one, add `testdino_rerun_sha` and pass it to `checkout` as shown in [Pin a same-commit re-run](#pin-a-same-commit-re-run). Otherwise, use **Latest**.

> [accordion] GitHub shows the branch tip for a This commit re-run
>
> GitHub starts a dispatched workflow from a branch, so the workflow run page shows the latest commit on the branch. The `ref:` line in `checkout` then switches the job to the commit you picked. The `HEAD is now at` line in the checkout step's log and the commit on the new test run in TestDino both show the pinned commit.
>
> To show the pinned commit on GitHub too, add a top-level `run-name` next to `name:` in the workflow. Other workflow runs keep their default title.
>
> ```yaml theme={null}
> run-name: ${{ inputs.testdino_rerun_from != '' && format('TestDino re-run @ {0}', inputs.testdino_rerun_sha || 'branch tip') || '' }}
> ```

## Related

> [card] [Re-run failed tests](https://docs.testdino.com/guides/debug-playwright-failures/rerun-failed-tests.md)
>
> Start a re-run from the dashboard, terminal, or an AI agent.

> [card] [GitHub Actions](https://docs.testdino.com/guides/playwright-github-actions.md)
>
> Report Playwright results from GitHub Actions.

> [card] [Node.js CLI](https://docs.testdino.com/cli/testdino-playwright-nodejs)
>
> Every `npx tdpw test` flag, including `--rerun`.

> [card] [MCP tools](https://docs.testdino.com/mcp/tools-reference.md)
>
> `rerun_test` parameters for agent-started re-runs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.