A CI step that calls an AI code review agent on every push, returns a structured score, and optionally blocks the merge if quality is below your threshold.
Create .github/workflows/code-review.yml:
name: AI Code Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run code review
run: |
DIFF=$(git diff origin/${{ github.base_ref }}...HEAD | head -c 12000)
RESPONSE=$(curl -sS -X POST https://www.runcept.com/api/v1/run \
-H "Authorization: Bearer ${{ secrets.RUNCEPT_API_KEY }}" \
-H "Content-Type: application/json" \
-d "{\"agent\": \"code-reviewer\", \"input\": {\"diff\": \"$DIFF\"}}")
JOB_ID=$(echo $RESPONSE | jq -r '.job_id')
for i in {1..20}; do
sleep 5
RESULT=$(curl -sS https://www.runcept.com/api/v1/jobs/$JOB_ID \
-H "Authorization: Bearer ${{ secrets.RUNCEPT_API_KEY }}")
STATUS=$(echo $RESULT | jq -r '.status')
if [ "$STATUS" = "complete" ]; then
SCORE=$(echo $RESULT | jq -r '.output.score')
echo "Code review score: $SCORE"
if [ "$SCORE" -lt 60 ]; then exit 1; fi
break
fi
done
const response = await fetch('https://www.runcept.com/api/v1/run', {
method: 'POST',
headers: {
'Authorization': Bearer ${process.env.RUNCEPT_API_KEY},
'Content-Type': 'application/json',
},
body: JSON.stringify({ agent: 'code-reviewer', input: { diff } }),
})
const { job_id } = await response.json()
// Poll for result
let result
while (true) {
await new Promise(r => setTimeout(r, 3000))
const poll = await fetch(https://www.runcept.com/api/v1/jobs/${job_id}, {
headers: { 'Authorization': Bearer ${process.env.RUNCEPT_API_KEY} }
})
result = await poll.json()
if (result.status === 'complete') break
}
console.log(result.output) // { score, issues, suggestions }
Use this agent on Runcept
View code-reviewer agent →