The moment it happens
Know right away when main fails
A failed pipeline on main reaches you with the jobs that broke and a link to it.
- Runs
- The moment it happens
- Apps
- GitLab
- AI
- Not needed
- Access
- read_api
Send this to your assistant
Create a ClickRuntime automation: email me when a GitLab pipeline on the main branch fails, listing the failed jobs and linking to the pipeline.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A failed pipeline on main is a stop sign for everyone: nothing should deploy, new branches are built on a broken base and the longer it stays red, the more commits pile up that could be the cause. GitLab's own emails go to the committer, who may be offline, so the failure is silent for the people who could actually help.
When GitLab sends a pipeline event, ClickRuntime checks whether the status is failed on the branch you chose. If it is, the failed jobs are listed and a notification goes out with the pipeline link, the commit author and the names of the jobs that broke, so the first person to see it knows where to look.
Teams that deploy from main and platform engineers who own the shared pipeline benefit most.
What you get out of it
Fixes start within minutes
Because the alert arrives as the pipeline fails, the person who pushed the commit is often still at their keyboard and can fix or revert before anyone else is blocked.
Failed jobs are named in the message
Listing which jobs failed, such as test or deploy, saves the first responder from opening the pipeline just to learn whether it is a flaky test or a real outage.
Shared awareness on main
A single notification to the team prevents each person finding out separately and asking in chat whether the build is broken for everyone. Fewer duplicated questions means calmer incident handling.
Fewer deploys on a broken base
Knowing main is red encourages people to hold their merges, which keeps broken code from piling up and keeps a clean revert possible. Reverting stays simple when nothing builds on a broken commit.
No noise from other branches
Limiting alerts to the branch you care about means a failing experiment branch never interrupts anyone, and each message is a signal worth acting on. Teams quickly learn to trust and act on a quiet, accurate channel.
How it works
What happens, step by step
When a GitLab pipeline finishes, GitLab tells ClickRuntime straight away.
ClickRuntime ignores everything except failed pipelines on the branch you chose, such as main.
It lists the jobs that failed.
You get an email with the project, branch, failed jobs and a link to the pipeline.
Before it runs live
- Connect GitLab
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
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 GitLab steps into one automation
Under the hood
The code that runs this automation
from clickruntime import on_event, credentials, http, notify
GITLAB = "https://gitlab.com/api/v4"
def gl_headers():
return {"PRIVATE-TOKEN": credentials.secret("GITLAB_TOKEN")}
BRANCH = "main"
@on_event
def handle(event):
body = event.json
p = body.get("object_attributes", {})
if body.get("object_kind") != "pipeline" or p.get("status") != "failed" or p.get("ref") != BRANCH:
return {"skipped": True}
project = body["project"]
jobs = http.get(f"{GITLAB}/projects/{project['id']}/pipelines/{p['id']}/jobs",
headers=gl_headers(), params={"scope": "failed"}).json()
lines = [f"- {j['stage']}: {j['name']}" for j in jobs]
notify.email_me(f"Pipeline failed on {project['path_with_namespace']}@{BRANCH}",
"\n".join(lines) + f"\n\n{project['web_url']}/-/pipelines/{p['id']}")
return {"failed_jobs": len(jobs)}FAQ
Common questions
Which GitLab event does it use?
Can I watch several branches?
Where can the notification be sent?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Block merge requests that break a rule
When a merge request changes, it is checked against your rule and gets a failing commit status if it breaks it.
See how it worksAnnounce opened and merged MRs in Slack
Your channel hears when a merge request in your project is opened or merged.
See how it worksGet an email for each review request
Whenever you are added as reviewer on a merge request, you get its title and link by email.
See how it worksKeep exploring
Set up “Know right away when main fails” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.