Skip to content

Every 5 minutes

Get alerted when a build fails on main

When a GitHub Actions run fails on main, you get a Slack message with the link within minutes.

Runs
Every 5 minutes
Apps
GitHub
AI
Not needed
Access
Actions: read

Send this to your assistant

Create a ClickRuntime automation: every 5 minutes, check GitHub Actions runs on the main branch of acme/app and post any failed run to #builds in Slack with the workflow name, commit and link.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A broken main branch costs the whole team. Someone merges a pull request on Friday afternoon, the GitHub Actions workflow fails on a flaky migration test, and nobody notices because the email notification went to the person who already left. Over the weekend more commits stack on top of a red build, and Monday starts with a hunt for which change broke it.

Every 5 minutes workflow runs with status failure are listed, narrowed to the main branch, and any that have not been announced are sent to Slack with the workflow name, branch, commit message and a link to the run. Each failure is remembered, so a run is posted exactly once.

It is helpful for any team that deploys from main and for maintainers who cannot watch the Actions tab all day. Pairing it with the pull request alerts gives a complete picture of repository activity.

What you get out of it

  • Broken builds are fixed while fresh

    The author of the failing change is still online and remembers what they touched, so the fix is often a five-minute revert instead of a Monday investigation. Rolling it back immediately keeps everyone else unblocked.

  • Deploys stop on top of failures

    Knowing main is red means nobody merges a further change or releases a build that was never green, which protects production from changes nobody tested. That saves hours of confusion in a busy repository.

  • The right people see it

    A channel post reaches the whole team instead of one inbox, and someone covering for a colleague on leave still gets the failure notice. Vacation and sick days no longer leave a red build unnoticed.

  • Each failure is one message

    Remembering announced runs avoids a stream of repeats when a workflow is re-run, so the channel stays quiet enough that people read every post. Alerts that people trust get read, while noisy ones get muted.

  • Links go straight to the logs

    The message links to the failed run, so the person responding opens the log in one click instead of navigating through the repository to find it. That saves precious minutes during an incident.

How it works

What happens, step by step

  1. Every five minutes, ClickRuntime checks your GitHub Actions runs on main for failures.

  2. It skips failures it has already reported.

  3. Each new failure is posted to your Slack channel with the commit and a link to the run.

Before it runs live

  • Connect GitHub

What you get

RunsEvery 5 minutes
Get alerted when a build fails on maintoday, 9:00Succeeded
Slack · #builds:x: CI failed on main · 3f9c2ab Bump parser to 2.1 https://github.com/acme/app/actions/runs/1123581321

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other GitHub steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
failed_ci_run_alert.pyexample
from clickruntime import on_trigger, credentials, http, state, notify, report_fetched

def gh(method, path, **kw):
    resp = http.request(method, f"https://api.github.com{path}", headers={
        "Authorization": f"Bearer {credentials.connection('github', 'work')}",
        "Accept": "application/vnd.github+json"}, **kw)
    resp.raise_for_status()
    return resp.json() if resp.content else None

REPO = "acme/app"

@on_trigger
def run(event):
    runs = gh("GET", f"/repos/{REPO}/actions/runs", params={"branch": "main", "status": "failure", "per_page": 20})["workflow_runs"]
    seen = set(state.get("seen") or [])
    new = [r for r in runs if r["id"] not in seen]
    report_fetched(len(new))
    if not new:
        return {"posted": 0}
    for r in new:
        notify.slack(f":x: {r['name']} failed on main · {r['head_sha'][:7]} {r['head_commit']['message'].splitlines()[0]}\n"
                     f"{r['html_url']}", channel="#builds")
    state.set("seen", sorted(seen | {r["id"] for r in new})[-500:])
    return {"posted": len(new)}

FAQ

Common questions

Does it only watch the main branch?
Yes, it narrows to the branch you name, which is main by default. Failures on feature branches are ignored so pull request experiments do not fill the channel. You can add other branches, such as release branches.
What happens if a failed run is re-run and passes?
The failure was already announced when it happened, so you still see that message. Passing re-runs are not announced, because the automation only reports failures. A recovery message can be added if you want it.
Which GitHub token is required to read Actions runs?
The token must be able to read workflow runs for the repository, which classic tokens grant under the repo scope and fine-grained tokens grant through Actions read access. It is stored as a secret in ClickRuntime.
What permissions does it need?
Actions: read. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Get alerted when a build fails on main” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.