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.
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.
ftuyama updated this issue · just now
Your existing test runs do the work. The reporter only reads artifacts — it never touches your code or your database.
An RSpec formatter writes one JSON file per run. Add the flag and upload it as an artifact — nothing else changes.
The reporter job downloads artifacts from recent workflow runs and groups every failure by its branch.
Specs that failed on two or more branches land in a single Flaky Specs Report issue, rewritten every time.
Everything you need to keep flaky specs visible — and nothing that adds another tool to manage.
A spec must fail on at least two different branches to be reported. Your own broken change stays out of the list.
Each spec is sorted by failure rate with a failures/total count, so the worst offenders surface first.
No duplicates, no stale threads. The same report issue is found and rewritten on every run.
Reads the JSON your workflow already uploads. No service, no database, no extra infrastructure.
Choose which workflow file to read and how many recent runs to aggregate. Defaults are sensible.
Scheduled, on demand, or locally with a token. The same script powers CI and your terminal.
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.
One red run on your feature branch is enough to be called flaky.
Failures must repeat across branches before they qualify as flaky.
Four small files, one require, one artifact upload. It slots into the workflow you already have.
Keep the same layout so the requires resolve.
In spec/spec_helper.rb or an equivalent support file.
require_relative '../lib/rspec/flaky/formatter'
Write the JSON, upload it, then point the reporter at your test workflow.
- 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/
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.
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.
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.
GITHUB_WORKFLOW_FILE. Each spec's
failure rate is computed across everything it was seen in.
continue-on-error: true, so flaky failures are recorded without
failing the build. The report is where they surface.
schedule block in the reporter workflow to run a cron job, for example
every night.
Add one formatter, upload one artifact, and let the reporter keep a trusted flaky-spec list for your team.