Skip to content

Quick start

  1. Get an API key from your model provider: for Claude, at console.anthropic.com (a Claude Pro or Max subscription isn’t an API key). Add it to your repository as a secret named ANTHROPIC_API_KEY: Settings → Secrets and variables → Actions → New repository secret.
  2. Commit .github/workflows/codemop.yml to your default branch (usually main), as it is:
name: CodeMop
on:
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
issue_comment:
types: [edited, created] # fixes ticked in CodeMop's summary; `/codemop check`
pull_request_review_comment:
types: [created] # someone replied `/codemop learn <why>` to a comment
permissions:
contents: write # to commit ticked fixes and learned notes
pull-requests: write
statuses: write # for the merge check, if you turn it on
# Reviews: a new push replaces one still running. Commits (fixes, notes) wait their turn
concurrency:
group: codemop-${{ github.event_name == 'pull_request_target' && 'review' || 'changes' }}-${{ github.event.pull_request.number || github.event.issue.number }}
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}
jobs:
codemop:
# On comments, only edits of CodeMop's summary, `/codemop check`, and `/codemop learn` replies (not on forks' PRs)
if: >-
github.event_name == 'pull_request_target' ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request && (
(github.event.action == 'edited' && contains(github.event.comment.body, 'codemop-summary')) ||
(github.event.action == 'created' && startsWith(github.event.comment.body, '/codemop check')))) ||
(github.event_name == 'pull_request_review_comment' && startsWith(github.event.comment.body, '/codemop learn') && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- uses: sgtwickool/codemop@v1
with:
api-key: ${{ secrets.ANTHROPIC_API_KEY }}

That’s it: every pull request from then on gets a review, usually within a minute. Drafts wait until they’re ready for review. Another provider? See Choosing a model.

No review?

  • The CodeMop run in your repository’s Actions tab says what happened
  • The workflow has to be on the default branch: GitHub runs it from there, so a pull request that adds it isn’t reviewed itself
  • The secret’s name has to match the one in the workflow
  • Drafts are skipped until they’re ready for review, and so are pull requests with more than 3,000 changed lines (max-changed-lines)

If you like it, the badge tells people who visit your repository: Reviewed by CodeMop

[![Reviewed by CodeMop](https://img.shields.io/badge/reviewed_by-CodeMop-ffc800?labelColor=16181d)](https://codemop.com)