Top 200 ReposEXPLORER
Browse agents, categories and pages
Back to results
Planned, not doneThe source describes an intention, not a finished result.

Reduce CI Flakiness Through Reproducible Overnight Test Experiments

Overview

A nightly GitHub Actions job runs Claude Code over recent CI results to rank flaky tests, rerun the worst few and open a pull request with a proposed fix and its evidence for a developer to review.

Problem or Objective

More in Coding and Code Review

AI Agents and Models

Tools and Integrations

Tools
Claude Code · GitHub Actions
Prerequisites
A GitHub repository with CI, the Claude GitHub App, and an Anthropic API key or subscription token stored as a repository secret.

How It Works

Install the Claude GitHub App and add the Claude Code GitHub Action to the repository, with an API key or subscription token stored as a repository secret. Create a workflow on a cron schedule, for example nightly, with a prompt that asks Claude to collect the results of recent CI runs, rank the tests that failed and then passed on a retry, and take the top few. For each, Claude reruns the test several times in the job, reads the test and the code under it, and writes down the likely cause (timing, shared state, test order, network). Grant only the tools the prompt needs with --allowedTools. Claude opens a pull request with a small fix and the evidence, or posts a report when it cannot reproduce the failure. A developer reviews every pull request, and the next night shows whether the test still fails.

Implementation Workflow

Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.

  1. Choose the agentSet up Claude Code.
  2. Connect the toolsConnect the tools this workflow relies on: Claude Code, GitHub Actions.
  3. Check the prerequisitesA GitHub repository with CI, the Claude GitHub App, and an Anthropic API key or subscription token stored as a repository secret.
  4. Gather your detailsCollect what the prompt asks for: Branch to analyse, Days of CI history, Tests to investigate per night.
  5. Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
  6. Check against the documentationCompare what you get with the documentation at code.claude.com before you rely on it.

Practical Starter Prompt: Rank and fix tonight's flakiest tests

Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].

Preview
Look at the CI runs for [Branch to analyse] over the last [Days of CI history] days. List tests that failed and then passed on a retry, ranked by how often. Take the top [Tests to investigate per night]. For each, rerun it repeatedly, read the test and the code under test, and explain the most likely cause with evidence. If you can reproduce the failure, open a pull request with a minimal fix and the evidence in the description; otherwise post a short report. Do not merge, skip or delete tests: a developer will review every change.

Start with a small number of tests per night and grant only the tools the prompt needs. Every pull request is reviewed by a developer before merge.

Expected Results and Benefits

This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.

This is a suggested workflow, not a reported outcome. Anthropic's docs say the Claude Code GitHub Action can run a prompt on any GitHub event, including a cron schedule, can turn issues into pull requests, and has no shell or GitHub API access until you grant tools. They do not describe flaky-test analysis, so how well it ranks and fixes flaky tests in your suite is untested.

Limitations and Considerations

GitHub runs scheduled workflows only from the default branch, and in public repositories it disables a schedule once the repository has had no activity for 60 days. Rerunning tests many times uses CI minutes and model usage, so cap the number of tests per night. A change that makes a test pass once can hide a real bug, so keep merges a human decision and never let the job skip or delete tests. Results depend on your setup and were not independently reproduced by Top 200 Repos.

GitHub Repositories

AI Agent Repository

Source code of the agent that does the work.

Official Website

The official site of the main tool or project in this use case.

Visit Website (opens in a new tab)code.claude.com

Related Videos

About anthropics/claude-code

About anthropics/claude-code

Independent creators. Listing a video implies no endorsement, sponsorship or partnership.

Sources

  1. Claude Code GitHub Actions - Claude Code Docs (opens in a new tab)

    Project documentation · code.claude.com · Undated · Source checked 26 Nov 2026, 17:27 UTC

    What this source supports
    • A GitHub Action runs Claude Code in repository workflows and can be used to turn issues into pull requests, fix bugs from a comment or automate recurring tasks.
    • With a prompt input the action runs in automation mode on any GitHub event, including a cron schedule; for a plain-text prompt Claude has no shell or GitHub API access until the needed tools are granted with --allowedTools.
    • GitHub runs scheduled workflows only from the default branch and, in public repositories, disables the schedule after 60 days without repository activity.
Report a problem

More with Claude Code

Planned, not done

Create Custom Store Tools Instead of Paying for Subscriptions

Use Claude Code to write small in-house tools for an online shop, such as a reply helper for support mail or a margin report, as an alternative to paying for separate apps, with testing before you rely on them.

code.claude.comanthropics/claude-code
Reported by source

Answer technical questions by letting async agents run experiments

Simon Willison sends research questions to cloud coding agents such as Claude Code for web and Codex Cloud, which write and run experiments in a dedicated repo and open a PR.

simonwillison.net · 6 Nov 2025anthropics/claude-code, openai/codex
Planned, not done

Structure Repeated Browser Research Into Evidence Tables

Give Claude Code the open-source Browser Use CLI with a local browser, ask the same research questions across a short list of pages, and keep every answer as a sourced table row.

github.comanthropics/claude-code, browser-use/browser-use

View all: Claude Code