Getting Started
AI Code Reviewer is an open source service that uses the OpenAI API to automatically review pull requests and provide inline feedback on code quality, potential bugs, and style issues. Point it at your GitHub repository and it posts review comments directly on your PRs. Available as an open web service in Eyevinn Open Source Cloud.
Prerequisites
- If you have not already done so, sign up for an Eyevinn OSC account
- An OpenAI API key with access to the GPT-4 model family
Step 1: Store your OpenAI API key as a secret
Before creating the instance, store your OpenAI API key as a Service Secret so it is never stored in plaintext. Navigate to the AI Code Reviewer service. Go to the Service Secrets tab and click New Secret.
Create a secret named openaikey with your OpenAI API key as the value.
Step 2: Create the AI Code Reviewer instance
Go to the My ai-code-reviewers tab and click Create ai-code-reviewer. Fill in:
- Name: a name for your instance (alphanumeric only, e.g.
myreviewer) - OpenAiApiKey:
{{secrets.openaikey}} - AssistantId (optional): the ID of a custom OpenAI Assistant to use for reviews. Leave empty to use the default review prompt.
Click Create and wait for the instance to reach running status.
Step 3: Configure your repository
Once running, open the instance URL to find the webhook endpoint and setup instructions. Add the webhook URL to your GitHub repository under Settings → Webhooks, selecting the Pull requests event.
The reviewer will post comments on new pull requests automatically.
Using the CLI
# Create a service secret for the OpenAI key
osc secret create eyevinn-ai-code-reviewer openaikey --value "sk-..."
# Create the AI Code Reviewer instance
osc create eyevinn-ai-code-reviewer myreviewer \
-o OpenAiApiKey="{{secrets.openaikey}}"
Resources
- AI Code Reviewer on GitHub
- OpenAI API documentation
- Working with Secrets — how to store API keys securely