Example workflows
Weekly scheduled detection
Section titled “Weekly scheduled detection”The recommended pattern: capture failures on every push, detect patterns once a week.
name: Flaky test detectionon: schedule: - cron: '0 9 * * 1' # Monday 9am UTC workflow_dispatch:
jobs: detect: runs-on: ubuntu-latest permissions: issues: write steps: - uses: brewpirate/flaky-tests@v1 with: store: turso connection-string: ${{ secrets.TURSO_URL }} auth-token: ${{ secrets.TURSO_AUTH_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} window-days: '7' threshold: '2' create-issues: 'true'CI with capture + detection on main
Section titled “CI with capture + detection on main”Capture failures on every PR and push. Detect patterns on main pushes only.
name: CIon: push: branches: [main] pull_request:
jobs: test: runs-on: ubuntu-latest permissions: issues: write steps: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun test env: FLAKY_TESTS_STORE: turso TURSO_URL: ${{ secrets.TURSO_URL }} TURSO_AUTH_TOKEN: ${{ secrets.TURSO_AUTH_TOKEN }}
# Detect patterns and open issues — only on main branch pushes - if: github.ref == 'refs/heads/main' && github.event_name == 'push' uses: brewpirate/flaky-tests@v1 with: store: turso connection-string: ${{ secrets.TURSO_URL }} auth-token: ${{ secrets.TURSO_AUTH_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} create-issues: 'true'Supabase store
Section titled “Supabase store”name: Flaky test detectionon: schedule: - cron: '0 9 * * 1' workflow_dispatch:
jobs: detect: runs-on: ubuntu-latest permissions: issues: write steps: - uses: brewpirate/flaky-tests@v1 with: store: supabase connection-string: ${{ secrets.SUPABASE_URL }} auth-token: ${{ secrets.SUPABASE_KEY }} github-token: ${{ secrets.GITHUB_TOKEN }} create-issues: 'true'Postgres / Neon store
Section titled “Postgres / Neon store”name: Flaky test detectionon: schedule: - cron: '0 9 * * 1' workflow_dispatch:
jobs: detect: runs-on: ubuntu-latest permissions: issues: write steps: - uses: brewpirate/flaky-tests@v1 with: store: postgres connection-string: ${{ secrets.POSTGRES_URL }} github-token: ${{ secrets.GITHUB_TOKEN }} create-issues: 'true'Capture-only (no detection)
Section titled “Capture-only (no detection)”Just accumulate data without opening issues — useful during initial rollout:
name: CIon: [push, pull_request]
jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v2 - run: bun install
- run: bun test env: FLAKY_TESTS_STORE: turso TURSO_URL: ${{ secrets.TURSO_URL }} TURSO_AUTH_TOKEN: ${{ secrets.TURSO_AUTH_TOKEN }} # No detection step — just captureDetection without issue creation
Section titled “Detection without issue creation”Check for patterns and fail CI if found, without creating GitHub issues:
- uses: brewpirate/flaky-tests@v1 with: store: turso connection-string: ${{ secrets.TURSO_URL }} auth-token: ${{ secrets.TURSO_AUTH_TOKEN }} create-issues: 'false' # No github-token neededThis exits 1 if patterns are found. Use continue-on-error: true if you don’t want to block CI.