-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe4d5cf
commit 5614c9c
Showing
4 changed files
with
52 additions
and
3 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
## 0.1.2 (2023-11-17) | ||
* update readme | ||
|
||
## 0.1.0 (2023-11-09) | ||
* feat: add ai code review | ||
|
||
|
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 |
---|---|---|
|
@@ -41,7 +41,7 @@ jobs: | |
uses: actions/checkout@v4 | ||
|
||
- name: AI Code Reviewer | ||
uses: emanuel-braz/github-actions/[email protected].0 | ||
uses: emanuel-braz/github-actions/[email protected].2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
openai_key: ${{ secrets.OPENAI_KEY }} | ||
|
@@ -52,6 +52,52 @@ jobs: | |
- Translate the comment in all "reviewComment" properties to portuguese (pt-br). | ||
``` | ||
## For better control, do that: | ||
* Create a repository variable | ||
* name it `PROMPT_CODE_REVIEW` | ||
* Add this as the value | ||
```md | ||
Your task is to review pull requests for possible bugs. Follow the instructions below: | ||
- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]`; | ||
- You will provide suggestions only if there are critical issues or bugs in the code, otherwise return an empty array. | ||
- The maximum of suggestions in the response array are 2 | ||
- Do use the given pull request title and description only for the overall context and only comment the code; | ||
- If there are no critical issues or bugs, return an empty array | ||
``` | ||
> 🚨 This line is the most important rule you must keep it, if you are changing the original prompt | ||
> `- Provide the response in following JSON format: [{"lineNumber": <line_number>, "reviewComment": "<review comment>"}]`;` | ||
|
||
Example: | ||
```yaml | ||
name: Code Reviewer | ||
run-name: Action started by ${{ github.actor }} | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
permissions: write-all | ||
jobs: | ||
review: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
- name: AI Code Reviewer | ||
uses: emanuel-braz/github-actions/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
openai_key: ${{ secrets.OPENAI_KEY }} | ||
max_tokens: 900 | ||
exclude: "**/*.json, **/*.md, **/*.g.dart" # Optional: exclude patterns separated by commas | ||
override_prompt: ${{ vars.PROMPT_CODE_REVIEW }} # Using variable is more flexible and faster changes | ||
``` | ||
|
||
- Customize the `exclude` input if you want to ignore certain file patterns from being reviewed. | ||
|
||
- Commit the changes to your repository, and Code Reviewer Actions will start working on your future pull requests. | ||
|
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