Quick start
- 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. - Commit
.github/workflows/codemop.ymlto your default branch (usuallymain), as it is:
name: CodeMopon: 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 turnconcurrency: 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:
[](https://codemop.com)