Register a GitHub app
python -c "import secrets; print(secrets.token_hex(10))"
). You’ll provide this to Sourcebot to be able to read webhook events from your app.Install the GitHub app in your organization
Install
Configure the environment variables in Sourcebot
GITHUB_APP_ID
: The client ID of your GitHub app. Can be found in your app settingsGITHUB_APP_WEBHOOK_SECRET
: The webhook secret you defined in your GitHub app. Can be found in your app settingsGITHUB_APP_PRIVATE_KEY_PATH
: The path to your app’s private key. If you’re running Sourcebot from a container, this is the path to this file from within your container
(ex /data/review-agent-key.pem
). You must copy the private key file into the directory you mount to Sourcebot (similar to the config file).OPENAI_API_KEY
: Your OpenAI API keyREVIEW_AGENT_API_KEY
: The Sourcebot API key that the review agent uses to hit the Sourcebot API to fetch code contextREVIEW_AGENT_AUTO_REVIEW_ENABLED
(default: false
): If enabled, the review agent will automatically review any new or updated PR. If disabled, you must invoke it using the command defined by REVIEW_AGENT_REVIEW_COMMAND
REVIEW_AGENT_REVIEW_COMMAND
(default: review
): The command that invokes the review agent (ex. /review
) when a user comments on the PR. Don’t include the slash character in this value.~/sourcebot_review_agent_workspace
, and I’m mounting that directory to Sourcebot/data
since that’s the directory in Sourcebot that I’m mounting toVerify configuration
Agents
in the Sourcebot nav menu. If you’ve configured your environment variables correctly you’ll see the following:REVIEW_AGENT_AUTO_REVIEW_ENABLED
environment variable to true.
You can invoke the review agent manually by commenting /review
on the PR you’d like it to review. You can configure the command that triggers the agent by changing
the REVIEW_AGENT_REVIEW_COMMAND
environment variable.