DEV Community

Filip Galic
Filip Galic

Posted on

I Built a GitHub Action That Uses AI to Explain Why Your CI Failed

We've all been there — your CI pipeline fails, you click through to the logs, and you're greeted with 2,000 lines of output. Somewhere in there is the actual error. Good luck finding it.

I got tired of scrolling, so I built CI Failure Summarizer — a GitHub Action that uses Claude AI to analyze your failed CI logs and sends you a human-readable summary on Slack.

How I Built It

I used Claude Code (Anthropic's CLI tool) to build the entire thing in one session. Went from idea to working GitHub Action in about an hour — including the DM feature I added halfway through because I thought "wouldn't it be cool if it messaged the person who broke the build directly?"

Claude Code handled everything: the GitHub Actions setup, Slack API integration, log parsing, and even wrote the README. Pretty wild experience honestly.

What It Does

When your workflow fails:

  1. Fetches the logs from the failed job
  2. Sends them to Claude for analysis
  3. Posts a summary to Slack with:
    • Root cause — what actually broke
    • The error — the specific message
    • Suggested fix — actionable next step
    • Link to the full logs

The Cool Part: DM the Person Who Broke the Build

Instead of posting to a channel, you can configure it to DM the committer directly. It looks up their GitHub email in Slack and sends them a private message.

No more "@channel who broke the build?" — the person responsible gets notified instantly.

Example Output

CI Failed: Build and Test

Repository: your-org/your-repo
Branch: feature/new-feature  
Commit: abc1234
Failed Jobs: test

---

1. **Root Cause**: Test assertion failed due to incorrect mock data
2. **Error**: Expected 200 but received 404 in api.test.js:42
3. **Suggested Fix**: Update the mock endpoint URL to match the new API route
Enter fullscreen mode Exit fullscreen mode

Setup (2 Minutes)

Add this to your workflow:

notify-on-failure:
  runs-on: ubuntu-latest
  needs: [build, test]
  if: failure()
  steps:
    - uses: galion96/ci-failure-sumarizer@v1
      with:
        anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
        slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
        notification_mode: dm  # or 'channel' for webhook
Enter fullscreen mode Exit fullscreen mode

Cost

Using Claude Sonnet: ~$0.01 per failure. If your CI fails 100 times a month, that's $1.

Links


What features would you want to see added? Drop a comment!

Top comments (0)