Skip to content

Commit

Permalink
Merge pull request #5 from codylabs/chore/workflows_model_option
Browse files Browse the repository at this point in the history
chore: update model option and readme
  • Loading branch information
daviddigital authored Sep 29, 2024
2 parents b534f40 + 4405256 commit 107c9f5
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# Optional: update to a model of your choice from https://platform.openai.com/docs/models
OPENAI_MODEL: "gpt-4o"

- name: Comment on Pull Request
run: |
Expand Down
39 changes: 28 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ Read more at [https://codylabs.io/](https://codylabs.io/)

## Installation

Installation is as simple as adding your Open API key, and creating a Github Actions workflow file to your repo.
Installation is as simple as adding your Open API key, and adding a Github Actions workflow file to your repo.

1. Add OPENAI_API_KEY as a GitHub repo secret via Settings > Actions > Secrets and variables > New repository secret. The variable name should be OPENAI_API_KEY, and the value should be your Open API API Key.

![Add secrets](add_a_secret_image.png)
<img src="openai.png" alt="Open API Api Key" width="500px">

<img src="repo_secrets.png" alt="Add secrets" width="800px">

Note that GITHUB_TOKEN does not need to be added as it is available by default.

2. Add the following file to a new folder in your repo .github/workflows/code_review.yml
2. Create a new folder and file in your repo **.github/workflows/code_review.yml**

Copy the file from here: [cody_review.yml](https://github.com/your-repo/.github/workflows/cody_review.yml)

Or available below:

```
name: Automated Code Review by Cody
Expand Down Expand Up @@ -53,6 +59,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# Optional: update to a model of your choice from https://platform.openai.com/docs/models
OPENAI_MODEL: "gpt-4o"
- name: Comment on Pull Request
run: |
Expand All @@ -67,38 +75,47 @@ permissions:

3. Commit your code, create a pull request and watch Cody in action!

![PR Code Review Image](pr_code_review.png)
<img src="cody_review_2.png" alt="PR Code Review Image" width="640px">

<img src="cody_review_1.png" alt="PR Code Review Image" width="640px">

## Development

Clone the repo.

Note venv (virtual environment) is used so ensure that versions etc are specific to this repo.
Note venv (virtual environment) is used to ensure that versions etc are specific to this repo.

`python -m venv venv` and
`pip install -r requirements.txt`

To activiate
To activiate:
`source venv/bin/activate`

To deactivate, `deactivate`
To deactivate:
`deactivate`

### Testing

Create an .env
Create an .env:

```
OPENAI_API_KEY=token_here
GITHUB_TOKEN=token_here
GITLAB_TOKEN=your_gitlab_token_here
```

And then run
And then run:

`PYTHONPATH=src pytest -s tests/`

This will run the code review logic on an GitHub Pull Request and log the output.

## License

See the LICENSE.md file for details.

## Contributing

Contributions are welcome! Whether it's submitting issues, suggesting improvements, or contributing code, we appreciate your input.

Please note that while this project is currently open for contributions, it is not open source. There may be an enterprise plan available in the future that will include additional features and support.

Feel free to reach out via [[email protected]](mailto:[email protected]) if you have any questions or ideas.
Binary file removed add_a_secret_image.png
Binary file not shown.
Binary file added cody_review_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cody_review_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed image.png
Binary file not shown.
Binary file added openai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added repo_secrets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 107c9f5

Please sign in to comment.