Intelligent Retries
for PHPUnit

Eliminate CI waste. Retrying failed tests and their @depends tree automatically.

Trusted by engineering teams at

How It Works

Instead of brute-forcing the entire suite, the action uses Graph Awareness to target only the relevant failures.

01. Intelligent Capture

It runs PHPUnit with --log-junit. This baseline captures every failure and skip state for deep analysis.

02. Surgical Extraction

The parser isolates failing methods from the XML report, instantly bypassing thousands of irrelevant passing assertions.

03. Graph Awareness

It analyzes @depends annotations. If a test fails, the system ensures its entire dependency chain is queued for context.

04. Optimized Relaunch

Triggers a new attempt using a dynamically generated filter. Save minutes by running only what actually broke.

Configuration Options

Fine-tune the retry logic with these environment inputs.

Input Parameter Required Default Description
commandYes-The PHPUnit execution command
test_dirYes-Test directory in workspace
max_attemptsNO3Maximum retry attempts allowed (1-10)
retry_wait_secondsNO10Seconds to wait between retries
shellNObashSupported: bash, sh, pwsh, python, cmd
timeout_minutesNO30Timeout per attempt (0 = no timeout)
github_tokenNO-Token for PR comments (pull-requests: write, contents: read)
job_idNO-Necessary to build direct URLs for Job logs

Before You Start

A few things to keep in mind when integrating the action.

Compatibility

Requires PHPUnit 9.x or later for JUnit XML and filter support.

Path Resolution

test_dir must be the workspace path, not the container path.

Vendor Tests

Works with vendor paths like vendor/co/pkg/tests/ out of the box.