A code review robot powered by ChatGPT
- Go to the repo homepage which you want integrate this bot
- click
settings
- click
actions
undersecrets and variables
- Change to
Variables
tab, create a new variableOPENAI_API_KEY
with the value of your open api key (For Github Action integration, set it in secrets) - Add this main.yml file on the root directory following this root: .github/workflows/main.yml
name: Cody Code Review permissions: contents: read pull-requests: write on: pull_request: types: [opened, reopened, synchronize] jobs: test: # if: ${{ contains(github.event.*.labels.*.name, 'gpt review') }} # Optional; to run only when a label is attached runs-on: ubuntu-latest steps: - uses: codeworks/Cody-CodeReview@main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- Cody will automatically do the code review when you create a new Pull request, the review information will show as inline comments in the pr timeline.
- After
git push
update the pull request, cr bot will re-review the changed files