π§ Find and track flaky CI jobs in GitHub Actions with OpenAI and Slack
β‘ 3 views Β· π§ Miscellaneous
π‘ Pro Tip β If you need GitHub data beyond what the REST API gives you, ScraperNode has a repository scraper that extracts metadata at scale without token rate limits.
Description
Quick Overview
This workflow runs daily (or on demand) to analyze GitHub Actions re-runs for a specific workflow and branch, identify flaky jobs by comparing pass/fail history across attempts, summarize likely causes with OpenAI, post a report to Slack, file GitHub issues for confirmed flakes, and store rates in an n8n Data Table.
How it works
- Runs every morning on a schedule or manually to start the analysis.
- Fetches recent completed GitHub Actions runs for the configured repository and branch, then keeps only the target workflowβs successful and failed runs and includes earlier attempts when a run was re-run.
- Retrieves all GitHub Actions jobs for each run attempt, paging through results so matrix workflows are fully captured.
- Aggregates job outcomes by job name to classify jobs as flaky, confirmed flaky (failed then passed on the same commit via re-run), broken, or one-off, and calculates flake rates and common failing step names.
- Compares current flake rates against the historical
flaky_jobsn8n Data Table to report only new or significantly worse flaky jobs. - Uses OpenAI to group the reported flaky jobs by likely intermittent cause based on the failing step names, then posts a formatted summary to the configured Slack channel.
- Creates GitHub issues (up to the configured limit) for confirmed flaky jobs and upserts the latest per-job flake rates and verdicts into the
flaky_jobsData Table.
Setup
- Create an HTTP Header Auth credential for GitHub with header name
Authorizationand valueBearer <your_token>that has permission to read Actions, and add a GitHub credential that can create issues in the target repository. - Configure the Settings values for
owner,repo,workflow_name(exactly as shown in GitHub Actions),branch, and optional thresholds likeruns_to_read,min_observations, andreport_when_worse_by. - Create an n8n Data Table named
flaky_jobswith columnsjob_key,job_name,flake_rate,failures,runs_seen,verdict, andlast_seen. - Add an OpenAI credential for the chat model used to summarize groups of flakes.
- Add a Slack credential and set the target channel name in
slack_channel(for example#ci).
π Nodes Used
GitHub, HTTP Request, Slack, Schedule Trigger, Basic LLM Chain, OpenAI Chat Model
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File