Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add openai to review the code #2511

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/code-review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Code Review

permissions:
contents: read
pull-requests: write

on:
pull_request:
branches:
- master
- release-*
paths-ignore:
- 'docs/**'
- '**.md'

jobs:
code-review:
runs-on: ubuntu-latest
steps:
- uses: oilbeater/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
MODEL: gpt-3.5-turbo
top_p: 1
temperature: 0.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code patch appears to be a GitHub Actions workflow file that triggers on pull request events and runs a job named "test" on an Ubuntu environment. The job uses the oilbeater/ChatGPT-CodeReview action, which likely performs some kind of code review using OpenAI's GPT-3 language model.

As for potential improvements, it would be helpful to include more information in the name field of the workflow file, such as the repository or project name. Additionally, it may be useful to add more steps to the job, such as running tests or linters, before invoking the code review action. Finally, it's worth noting that the use of third-party actions like oilbeater/ChatGPT-CodeReview carries some risk, so it's important to thoroughly vet any external dependencies before including them in a workflow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code patch appears to be a GitHub Actions workflow file for performing code reviews using the ChatGPT language model from OpenAI. Here are some observations and suggestions:

  • The name field is not necessary, but it can be helpful for identifying the workflow in the Actions tab of the repository.
  • The permissions field is not necessary unless you want to restrict access to the workflow.
  • The on field specifies that the workflow should run on pull requests targeting the master branch or any branch starting with release-, but ignoring changes to files in the docs/ directory or any Markdown files. This seems reasonable, but you may want to adjust the branch names depending on your project's branching strategy.
  • The jobs field defines a single job called code-review that runs on an Ubuntu environment. The job consists of a single step that uses the oilbeater/ChatGPT-CodeReview action to perform the code review. The action requires several environment variables to be set, including the GitHub token and the OpenAI API key. The MODEL, top_p, and temperature variables control the behavior of the language model. These values seem reasonable, but you may want to experiment with different settings to see what works best for your project.
  • There is no newline at the end of the file, which may cause issues with some tools.

Overall, this code patch looks reasonable, but it's hard to say for sure without knowing more about the project and its requirements. Some potential improvements might include adding additional steps to the job (e.g., running linters or other static analysis tools), customizing the behavior of the ChatGPT action (e.g., by passing additional arguments), or adding more granular control over when the workflow runs (e.g., by using the schedule or workflow_dispatch events).