Skip to content

The moment it happens

Get told the moment main fails

When a workflow on main ends in failure or error, you get the workflow name and a direct link right away.

Runs
The moment it happens
Apps
CircleCI
AI
Not needed
Access
project webhook setup (one-time); read

Send this to your assistant

Create a ClickRuntime automation: give me a webhook link for my CircleCI project. When a workflow on main finishes as failed or error, email me the project, workflow name and a link to it.

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

The most expensive build failure is the one that is noticed late. Someone merges to main before lunch, the CircleCI workflow fails ten minutes later, and the author has already moved on to another task. By the time a teammate pulls main and hits the problem, three more commits are stacked on top of the broken one.

As soon as CircleCI reports that a workflow finished, this checks whether its status is failed or error on the branch you chose, and ignores everything else. Only genuine failures on that branch result in a notification, so the channel stays quiet on ordinary green builds.

It works best on main or release branches, where a red build blocks the whole team rather than one developer's pull request. The check happens as the event arrives, so the filtering costs nothing and nobody receives a message about a build that passed or a branch they never touch.

What you get out of it

  • Fix the broken commit while it is fresh

    The author still remembers what they changed minutes after the failure. A quick notification shortens the path from breaking main to reverting or fixing it, before more commits pile on top. A small revert is much easier than untangling several commits that were built on top of a broken one.

  • Keep main deployable

    If releases ship from main, every minute it stays red is a minute you cannot ship a hotfix. Immediate alerts keep that window small and the release path available. That protects both urgent fixes and planned releases, because the team knows main is healthy before cutting anything from it.

  • Filter out noise from feature branches

    Only the branch you choose triggers a message. Developers do not get alerts about their colleagues' experimental work, so the notification keeps its meaning and people do not mute it. Quiet channels get read, which is the whole point of filtering by branch and status instead of posting every result.

  • Make the whole team aware at once

    A shared notification means everyone knows main is broken without checking individually. That prevents several people each pulling, failing, and debugging the same problem in parallel. People then stop discovering the failure one by one, and the first person to see it can tell the rest.

  • Create a clear incident record

    Each alert carries the time of the failure. Later, when reviewing how long main was red, you have precise timestamps instead of relying on a vague memory of the afternoon. It is the easiest way to review afterwards how long an incident lasted and which commit caused it.

How it works

What happens, step by step

  1. Each time a CircleCI workflow finishes, CircleCI tells ClickRuntime straight away.

  2. It ignores workflows on other branches and any that succeeded, keeping only failures or errors on main.

  3. You get an email right away with the project, the workflow name and a direct link to the failed run.

Before it runs live

  • Connect CircleCI
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Get told the moment main failsjust nowSucceeded
Email · CircleCI failureCircleCI failed: web-app / build-and-test https://app.circleci.com/pipelines/gh/acme/web-app/1287/workflows/…

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 CircleCI 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.
get_alerted_when_a_workflow_fails.pyexample
from clickruntime import on_event, notify

@on_event
def handle(event):
    body = event.json or {}
    if body.get("type") != "workflow-completed":
        return {"skipped": "not a workflow event"}
    wf = body["workflow"]
    branch = body.get("pipeline", {}).get("vcs", {}).get("branch")
    if branch != "main" or wf["status"] not in ("failed", "error"):
        return {"skipped": f"{branch} {wf['status']}"}
    notify.email_me(f"CircleCI {wf['status']}: {body['project']['name']} / {wf['name']}",
                    f"Project: {body['project']['name']}\nWorkflow: {wf['name']}\nStatus: {wf['status']}\n{wf['url']}")
    return {"emailed": True}

FAQ

Common questions

Does it alert on cancelled workflows?
No. It only acts on workflows whose status is failed or error. Cancelled, successful and on-hold workflows are filtered out, because a manual cancel is a decision, not a problem. The decision to cancel or retry a workflow belongs to a person, so a cancelled run is treated as a deliberate act and not reported.
How fast does the alert arrive?
The notification goes out when CircleCI sends its workflow completed event, which is typically within seconds of the workflow ending. There is no schedule, so it does not wait for a polling interval. It does not wait for a schedule or a polling cycle, so the notice goes out as soon as CircleCI sends the event.
Do I configure something in CircleCI?
Yes. You add a webhook in the CircleCI project settings pointing at the endpoint ClickRuntime provides, and select the workflow completed event. Secrets for verification are stored securely rather than in the message. Verification credentials stay as secrets and out of chat messages, so the channel only ever shows the failure details.
What permissions does it need?
project webhook setup (one-time); 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 for each event the app sends.
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 told the moment main fails” from your assistant

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