Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuel-braz committed Nov 17, 2023
1 parent fe4d5cf commit 5614c9c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
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

Expand Down
48 changes: 47 additions & 1 deletion code-review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "braz-actions",
"version": "0.1.0",
"version": "0.1.2",
"private": true,
"description": "GitHub Actions",
"main": "create-update-release/action.js",
Expand Down
2 changes: 1 addition & 1 deletion simple-chat-gpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- name: Ask question
id: chat
uses: emanuel-braz/github-actions/simple-chat-gpt@0.0.11
uses: emanuel-braz/github-actions/simple-chat-gpt@0.1.2
with:
prompt: Who was Alberto Santos-Dumont?
openai_key: ${{ secrets.OPENAI_KEY }}
Expand Down

0 comments on commit 5614c9c

Please sign in to comment.