Schedule icon
Webhook icon
Request icon
Script icon
If icon
SlackIncomingWebhook icon
Log icon

Detect Flaky GitHub Actions Workflows

Detect flaky GitHub Actions workflows from recent success/failure transitions and alert Slack with evidence.

Categories
BusinessInfrastructure

A workflow that fails, passes, fails, and passes again is different from a workflow that fails every time. This blueprint analyzes recent completed GitHub Actions runs and combines failure rate with outcome transitions to surface workflows that deserve a flaky-test investigation.

How it works

  1. fetch_runs calls the GitHub workflow-runs API.
  2. analyze_flakiness calculates completed-run count, failure rate, and outcome transitions.
  3. evaluate_flakiness alerts Slack only when the configured evidence thresholds are met.
  4. The errors block alerts separately when the audit itself fails.
  5. A disabled weekday Schedule and authenticated Webhook provide recurring and on-demand triggers.

Prerequisites

  • A GitHub token with read access to Actions runs.
  • A Slack Incoming Webhook.

Secrets

  • GITHUB_TOKEN: token used to query the GitHub Actions workflow-runs API.
  • SLACK_WEBHOOK_URL: Slack webhook for suspected-flakiness and failure alerts.

Quick start

  1. Add both secrets to the Kestra namespace.
  2. Set repository and workflow_file.
  3. Run manually and inspect flakiness_summary.
  4. Adjust failure_rate_threshold and min_transitions for your team's tolerance.
  5. Enable the weekday schedule after validating the signal.

How to extend

  • Inspect individual jobs and test names to identify the flaky job.
  • Persist historical summaries in a warehouse to trend flakiness.
  • Open a GitHub issue after the signal persists for several audits.
  • Add a ForEach task to audit multiple workflow files.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.