<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Joas Elegbe</title>
    <description>The latest articles on Forem by Joas Elegbe (@joas_elegbe_82a0a7dd3ba72).</description>
    <link>https://forem.com/joas_elegbe_82a0a7dd3ba72</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3895499%2Fb0b4866f-5ffc-403e-836c-7d0b5cc528d0.jpg</url>
      <title>Forem: Joas Elegbe</title>
      <link>https://forem.com/joas_elegbe_82a0a7dd3ba72</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/joas_elegbe_82a0a7dd3ba72"/>
    <language>en</language>
    <item>
      <title>I Plugged OpenClaw Into My CI/CD Pipeline — And I'll Never Merge a PR Without It Again</title>
      <dc:creator>Joas Elegbe</dc:creator>
      <pubDate>Fri, 24 Apr 2026 07:43:19 +0000</pubDate>
      <link>https://forem.com/joas_elegbe_82a0a7dd3ba72/i-plugged-openclaw-into-my-cicd-pipeline-and-ill-never-merge-a-pr-without-it-again-edl</link>
      <guid>https://forem.com/joas_elegbe_82a0a7dd3ba72/i-plugged-openclaw-into-my-cicd-pipeline-and-ill-never-merge-a-pr-without-it-again-edl</guid>
      <description>&lt;p&gt;Three weeks ago, I shipped a bug to production. Nothing catastrophic — a race condition in a Node.js endpoint, an edge case nobody on the team caught during review. The kind of mistake that slips through when you're in a hurry, tired, or just trusting a diff that's a little too long.&lt;br&gt;
That bug is what made me build CodeClaw — an AI-powered code review assistant, built on OpenClaw, integrated directly into my GitHub Actions pipeline.&lt;br&gt;
The Problem: Code Review Is a Bottleneck&lt;br&gt;
In my 4-person engineering team, every PR waits an average of 6 to 14 hours before getting a first review. Not because we're lazy — but because we're busy, and a good review takes context, focus, and time.&lt;br&gt;
Static tools like ESLint or SonarCloud do a great job on syntax and known anti-patterns. But they don't understand intent. They can't spot business logic bugs, subtle regressions, or questionable architectural decisions.&lt;br&gt;
That's exactly where OpenClaw comes in.&lt;br&gt;
How CodeClaw Works&lt;br&gt;
PR opened on GitHub&lt;br&gt;
       │&lt;br&gt;
       ▼&lt;br&gt;
GitHub Actions triggered&lt;br&gt;
       │&lt;br&gt;
       ▼&lt;br&gt;
Python script fetches the diff via GitHub API&lt;br&gt;
       │&lt;br&gt;
       ▼&lt;br&gt;
Diff + repo context sent to OpenClaw&lt;br&gt;
       │&lt;br&gt;
       ▼&lt;br&gt;
OpenClaw analyzes and generates a structured report&lt;br&gt;
       │&lt;br&gt;
       ▼&lt;br&gt;
Automated comment posted on the PR&lt;/p&gt;

&lt;p&gt;The core of the system is under 80 lines of Python. Here's the essential part:&lt;br&gt;
import os&lt;br&gt;
import httpx&lt;br&gt;
from github import Github&lt;/p&gt;

&lt;p&gt;OPENCLAW_API_KEY = os.environ["OPENCLAW_API_KEY"]&lt;br&gt;
GITHUB_TOKEN = os.environ["GITHUB_TOKEN"]&lt;/p&gt;

&lt;p&gt;def get_pr_diff(repo_name: str, pr_number: int) -&amp;gt; str:&lt;br&gt;
    g = Github(GITHUB_TOKEN)&lt;br&gt;
    repo = g.get_repo(repo_name)&lt;br&gt;
    pr = repo.get_pull(pr_number)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;diff_lines = []
for file in pr.get_files():
    diff_lines.append(f"### {file.filename}\n{file.patch or ''}")

return "\n\n".join(diff_lines)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;def analyze_with_openclaw(diff: str, context: str) -&amp;gt; dict:&lt;br&gt;
    prompt = f"""&lt;br&gt;
You are a senior code reviewer. Analyze this diff and provide:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A summary of the changes (2-3 sentences)&lt;/li&gt;
&lt;li&gt;Potential risks (bugs, security, performance)&lt;/li&gt;
&lt;li&gt;Concrete improvement suggestions&lt;/li&gt;
&lt;li&gt;An overall score from 1 to 5&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Project context: {context}&lt;/p&gt;

&lt;p&gt;Diff:&lt;br&gt;
{diff}&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;response = httpx.post(
    "https://api.openclaw.dev/v1/analyze",
    headers={"Authorization": f"Bearer {OPENCLAW_API_KEY}"},
    json={"prompt": prompt, "model": "claw-3-opus"}
)
return response.json()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;def post_review_comment(repo_name: str, pr_number: int, analysis: dict):&lt;br&gt;
    g = Github(GITHUB_TOKEN)&lt;br&gt;
    repo = g.get_repo(repo_name)&lt;br&gt;
    pr = repo.get_pull(pr_number)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;comment = f"""
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  CodeClaw — Automated Review
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;: {analysis['summary']}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Detected Risks&lt;/strong&gt;:&lt;br&gt;
{analysis['risks']}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Suggestions&lt;/strong&gt;:&lt;br&gt;
{analysis['suggestions']}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overall Score&lt;/strong&gt;: {'⭐' * analysis['score']} ({analysis['score']}/5)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Generated by CodeClaw · Powered by OpenClaw&lt;/em&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pr.create_issue_comment(comment)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;And the GitHub Actions workflow:&lt;br&gt;
name: CodeClaw Review&lt;/p&gt;

&lt;p&gt;on:&lt;br&gt;
  pull_request:&lt;br&gt;
    types: [opened, synchronize]&lt;/p&gt;

&lt;p&gt;jobs:&lt;br&gt;
  review:&lt;br&gt;
    runs-on: ubuntu-latest&lt;br&gt;
    steps:&lt;br&gt;
      - uses: actions/checkout@v4&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  - name: Set up Python
    uses: actions/setup-python@v5
    with:
      python-version: '3.12'

  - name: Install dependencies
    run: pip install httpx PyGithub

  - name: Run CodeClaw
    env:
      OPENCLAW_API_KEY: ${{ secrets.OPENCLAW_API_KEY }}
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      PR_NUMBER: ${{ github.event.pull_request.number }}
      REPO_NAME: ${{ github.repository }}
    run: python codeclaw.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;What It Looks Like in Practice&lt;br&gt;
For the past three weeks, every PR in our repository has automatically received a CodeClaw comment within 90 seconds of being opened. Here are some real examples of what OpenClaw caught:&lt;/p&gt;

&lt;p&gt;A memory leak in a React event handler — an addEventListener with no corresponding removeEventListener&lt;br&gt;
A SQL injection vulnerability in a query built through string concatenation in legacy code nobody had touched in 8 months&lt;br&gt;
Tight coupling between two modules that was going to make future unit testing painful&lt;/p&gt;

&lt;p&gt;That last one surprised me the most. ESLint would never have flagged it. SonarCloud wouldn't either. It's an architectural observation that requires actually understanding the code, not just scanning it.&lt;br&gt;
What I Learned&lt;br&gt;
OpenClaw is not a replacement for human review. It's an intelligent first filter that arrives before your teammates do. It catches the obvious stuff, raises the right questions, and lets human reviewers focus on what really matters: product vision alignment, long-term architectural choices, mentorship.&lt;br&gt;
The real win isn't speed it's quality of attention. When your colleague opens your PR, the low-hanging fruit has already been sorted. The conversation can go deeper from the start.&lt;br&gt;
Context injection is everything. Early versions of CodeClaw produced generic feedback. It wasn't until I started injecting project-specific context tech stack, team conventions, business domain that the analyses became genuinely useful. OpenClaw is a precision tool. It deserves precise instructions.&lt;br&gt;
What's Next&lt;br&gt;
I'm working on CodeClaw v2 with:&lt;/p&gt;

&lt;p&gt;A review history so OpenClaw learns recurring patterns in our codebase&lt;br&gt;
A Slack integration to alert the team about critical risks in real time&lt;br&gt;
A metrics dashboard to track code quality trends over time&lt;/p&gt;

&lt;p&gt;The source code is on GitHub. If you want to try it on your own repo, everything is in the README  expect about 15 minutes to get a working integration up and running.&lt;br&gt;
That production bug three weeks ago? It wouldn't have made it past CodeClaw.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>openclawchallenge</category>
    </item>
  </channel>
</rss>
