-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add extra criteria input used by ChatGPT (#4)
Add extra criteria input that will be used by ChatGPT in order to tune the initial instructions for the review.
- Loading branch information
Showing
5 changed files
with
81 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,15 @@ jobs: | |
id: chatgpt_pr_reviewer | ||
uses: ./ # Uses an action in the root directory | ||
# or use a released Github Action | ||
# uses: osl-incubator/github-action/github-[email protected].0 | ||
# uses: osl-incubator/[email protected].3 | ||
with: | ||
openai_api_key: ${{ secrets.OPENAI_API_KEY }} | ||
openai_model: 'gpt-3.5-turbo' | ||
openai_temperature: 0.5 | ||
openai_max_tokens: 2048 | ||
openai_extra_criteria: | # optional, use `;` for separate the criteria items | ||
- prefer readable variable name instead of short names like `k` and `v`, when apply; | ||
- verify `SOLID` principles design pattern violations, when apply; | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
github_pr_id: ${{ github.event.number }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,16 +9,43 @@ Include the following into your github actions step | |
|
||
```yaml | ||
- name: GitHub Actions ChatGPT PR Reviewer | ||
uses: osl-incubator/[email protected].2 | ||
uses: osl-incubator/[email protected].3 | ||
with: | ||
openai_api_key: ${{ secrets.OPENAI_API_KEY }} | ||
openai_model: 'gpt-3.5-turbo' | ||
openai_temperature: 0.5 | ||
openai_max_tokens: 2048 | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
github_pr_id: ${{ github.event.number }} | ||
openai_api_key: ${{ secrets.OPENAI_API_KEY }} # required | ||
openai_model: 'gpt-3.5-turbo' # optional | ||
openai_temperature: 0.5 # optional | ||
openai_max_tokens: 2048 # optional | ||
openai_extra_criteria: | # optional, use `;` for separate the criteria items | ||
- prefer readable variable name instead of short names like `k` and `v`, when apply; | ||
- verify `SOLID` principles design pattern violations, when apply; | ||
github_token: ${{ secrets.GITHUB_TOKEN }} # required | ||
github_pr_id: ${{ github.event.number }} # required | ||
``` | ||
Note: this GitHub actions is based on the following tutorial: | ||
https://shipyard.build/blog/your-first-python-github-action/ | ||
and very inspired on https://github.com/cirolini/chatgpt-github-actions | ||
The initial criteria use for the ChatGPT would look like this: | ||
``` | ||
You are a GitHub PR reviewer bot, so you will receive a text that | ||
contains the diff from the PR with all the proposal changes and you | ||
need to take a time to analyze and check if the diff looks good, or | ||
if you see any way to improve the PR, you will return any suggestion | ||
in order to improve the code or fix issues, using the following | ||
criteria for recommendation: | ||
- best practice that would improve the changes | ||
- code style formatting | ||
- recommendation specific for that programming language | ||
- performance improvement | ||
- improvements from the software engineering perspective | ||
- docstrings, when it applies | ||
- prefer explicit than implicit, for example, in python, avoid | ||
importing using `*`, because we don't know what is being imported | ||
``` | ||
Note: This initial criteria is presented here just to give an idea about | ||
what is used, for the latest version used, check the main.py file. | ||
## References | ||
This GitHub actions: | ||
- is based on the following tutorial: https://shipyard.build/blog/your-first-python-github-action/ | ||
- and very inspired on https://github.com/cirolini/chatgpt-github-actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters