How it works Features Install FAQ View on GitHub ↗
Open source · MIT licensed · Built for RSpec

Know which specs
are actually flaky.

A spec is only flaky if it failed on two different branches. This reporter compares failures across GitHub Actions runs and keeps a single, always-current issue — so you never chase the failure you just introduced.

5Runs scanned
2+Branches to qualify
1Issue, always current

Flaky Specs Report #42

ftuyama updated this issue · just now

open
runs 5 branches main, develop, feature/checkout generated 02:00 UTC
spec/models/user_spec.rb:42 validates email uniqueness under concurrency 60.0%
spec/services/checkout_spec.rb:118 completes payment when the webhook is delayed 40.0%
spec/requests/signup_spec.rb:27 returns 201 with a normalized phone number 40.0%
Rebuilt on every merge — no dashboards to babysit.
Works with RSpec 3 Ruby 3.4 GitHub Actions No database
How it works

Three moves. Zero maintenance.

Your existing test runs do the work. The reporter only reads artifacts — it never touches your code or your database.

01

Run specs as usual

An RSpec formatter writes one JSON file per run. Add the flag and upload it as an artifact — nothing else changes.

02

Collect the last runs

The reporter job downloads artifacts from recent workflow runs and groups every failure by its branch.

03

Update one issue

Specs that failed on two or more branches land in a single Flaky Specs Report issue, rewritten every time.

Features

Signal, not noise.

Everything you need to keep flaky specs visible — and nothing that adds another tool to manage.

Cross-branch detection

A spec must fail on at least two different branches to be reported. Your own broken change stays out of the list.

Ranked by flakiness

Each spec is sorted by failure rate with a failures/total count, so the worst offenders surface first.

One issue, always fresh

No duplicates, no stale threads. The same report issue is found and rewritten on every run.

Artifact-native

Reads the JSON your workflow already uploads. No service, no database, no extra infrastructure.

Configurable window

Choose which workflow file to read and how many recent runs to aggregate. Defaults are sensible.

Run it anywhere

Scheduled, on demand, or locally with a token. The same script powers CI and your terminal.

The rule

Why two branches?

Most flaky-test detectors guess. A spec failed once, so it must be flaky — and the report fills with noise that everyone learns to ignore.

Requiring a failure on more than one branch filters out the regression you just introduced and leaves the tests that fail on their own.

Naive detector

noisy

One red run on your feature branch is enough to be called flaky.

1 failure→ reported

Flaky RSpec Reporter

trusted

Failures must repeat across branches before they qualify as flaky.

2+ branches→ reported
Install

Up and running in minutes.

Four small files, one require, one artifact upload. It slots into the workflow you already have.

1

Copy the reporter into your repo

Keep the same layout so the requires resolve.

lib/rspec/flaky/formatter.rb RSpec formatter · writes JSON per run
scripts/generate_report.rb Entrypoint for the report job
scripts/report_builder.rb Aggregates runs, builds the markdown
scripts/github_integration.rb Fetches artifacts, updates the issue
2

Load the formatter

In spec/spec_helper.rb or an equivalent support file.

spec/spec_helper.rb
require_relative '../lib/rspec/flaky/formatter'
3

Wire up the workflows

Write the JSON, upload it, then point the reporter at your test workflow.

.github/workflows/tests.yml
- name: Run RSpec with Flaky Reporter
  run: |
    bundle exec rspec \
      --format RSpec::Flaky::Formatter \
      --out artifacts/flaky-rspec-${{ matrix.run }}.json
  continue-on-error: true

- name: Upload test artifacts
  uses: actions/upload-artifact@v4
  with:
    name: rspec-results-${{ matrix.run }}
    path: artifacts/
.github/workflows/flaky-specs-reporter.yml
permissions:
  actions: read
  issues: write
  contents: read

# ... after checkout and ruby/setup-ruby ...
- name: Run Flaky Consolidation
  run: ruby ./scripts/run.rb
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    GITHUB_REPO_NAME: ${{ github.repository }}
    GITHUB_WORKFLOW_FILE: 'tests.yml'

GITHUB_WORKFLOW_FILE must be the filename of the workflow that uploads the rspec-results-* artifacts.

4

Run it

Trigger the reporter from Actions, or run it locally.

In GitHub: Actions → Flaky Specs Reporter → Run workflow. The job aggregates the last 5 runs and updates the Flaky Specs Report issue.

terminal
GITHUB_TOKEN=ghp_xxx \
GITHUB_REPO_NAME=owner/repo \
GITHUB_WORKFLOW_FILE=tests.yml \
ruby scripts/generate_report.rb

The token needs actions: read and issues: write.

FAQ

Good questions.

What exactly counts as flaky?
A spec that failed in workflow runs from at least two different branches. A single failure, or repeated failures on one branch, is treated as a real regression — not flakiness.
Does it need a database or external service?
No. It reads JSON artifacts from your GitHub Actions runs and writes to a GitHub issue. Nothing to host, nothing to migrate.
How many runs does it look at?
By default, the last 5 runs of the workflow named in GITHUB_WORKFLOW_FILE. Each spec's failure rate is computed across everything it was seen in.
Will it create duplicate issues?
Never. It looks for an open issue titled Flaky Specs Report and updates it in place, creating it only the first time.
Does my test job fail if specs are flaky?
No. The RSpec step uses continue-on-error: true, so flaky failures are recorded without failing the build. The report is where they surface.
Can I run it on a schedule?
Yes. Uncomment the schedule block in the reporter workflow to run a cron job, for example every night.
What's the license?
MIT. Use it, fork it, and open an issue if something breaks.

Stop guessing. Start catching.

Add one formatter, upload one artifact, and let the reporter keep a trusted flaky-spec list for your team.