Skip to content

Commit 3c62cdd

Browse files
New version v0.6
- Add anthropic provider
1 parent 54be695 commit 3c62cdd

17 files changed

+1411
-707
lines changed

README.md

Lines changed: 63 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
11
# AI Code Review
2-
3-
Perform code review using various AI models (OpenAI, Google, Anthropic, Deepseek) on your GitHub repositories.
2+
*is a GitHub Action that is 90% generated by AIs.
43

54
## Description
65

7-
Perform code review using various AI models to analyze and provide feedback on your code. This GitHub Action helps improve the code quality by automatically reviewing pull requests, focusing on specified file extensions, and excluding specific paths.
6+
Perform code review using various AI models (from OpenAI, Anthropic, and soon Google, Deepseek) to analyze and provide feedback on your code. This GitHub Action helps improve the code quality by automatically reviewing pull requests, focusing on specified file extensions, and excluding specific paths.
87

98
## Inputs
109

1110
***token*** - Required. This GitHub token is used for authentication and to access your GitHub repository.
1211

13-
***ai_provider*** - Required. The AI provider to use (openai, google, anthropic, or deepseek). Default is 'openai'.
12+
***owner*** - Required. The username of the repository owner.
13+
14+
***repo*** - Required. The name of the repository.
15+
16+
***pr_number*** - Required. The number of the pull request that needs to be reviewed.
17+
18+
***ai_provider*** - Required. The AI provider to use (openai, anthropic, and soon google, deepseek). Default is 'openai'.
19+
1420

1521
***openai_api_key*** - Required if using OpenAI provider. This key is necessary to access OpenAI's API for code review purposes.
1622

17-
***openai_model*** - Optional. The OpenAI model name (e.g., gpt-4o, o3-mini). Default is 'gpt-4o'.
23+
***openai_model*** - Optional. The OpenAI model name (e.g., gpt-4o). Default is 'gpt-4o'.
24+
25+
26+
***anthropic_api_key*** - Required if using Anthropic provider. This key is necessary to access Anthropic's API for code review purposes.
27+
28+
***anthropic_model*** - Optional. The Anthropic model name (e.g., claude-3-7-sonnet-20250219). Default is 'claude-3-7-sonnet-latest'.
29+
1830

1931
***google_api_key*** - Required if using Google provider. This key is necessary to access Google's API for code review purposes.
2032

2133
***google_model*** - Optional. The Google model name (e.g., gemini-2.0-flash-thinking-exp-01-21). Default is 'gemini-2.0-flash-thinking-exp-01-21'.
2234

23-
***anthropic_api_key*** - Required if using Anthropic provider. This key is necessary to access Anthropic's API for code review purposes.
24-
25-
***anthropic_model*** - Optional. The Anthropic model name (e.g., claude-3-5-sonnet-20241022). Default is 'claude-3-5-sonnet-20241022'.
2635

2736
***deepseek_api_key*** - Required if using Deepseek provider. This key is necessary to access Deepseek's API for code review purposes.
2837

2938
***deepseek_model*** - Optional. The Deepseek model name (e.g., deepseek-reasoner). Default is 'deepseek-reasoner'.
3039

31-
***owner*** - Required. The username of the repository owner.
32-
33-
***repo*** - Required. The name of the repository.
34-
35-
***pr_number*** - Required. The number of the pull request that needs to be reviewed.
3640

3741
***include_extensions*** - Optional. A comma-separated list of file extensions to include in the review (e.g., ".py,.js,.html"). If not specified, the action will consider all file types.
3842

@@ -62,7 +66,7 @@ jobs:
6266
runs-on: ubuntu-latest
6367
steps:
6468
- name: AI Code Review
65-
uses: AleksandrFurmenkovOfficial/ai-code-review@v0.5
69+
uses: AleksandrFurmenkovOfficial/ai-code-review@v0.6
6670
with:
6771
token: ${{ secrets.GITHUB_TOKEN }}
6872
owner: ${{ github.repository_owner }}
@@ -74,10 +78,10 @@ jobs:
7478
openai_model: 'gpt-4o'
7579
```
7680
77-
### Advanced Configuration Example
81+
### Anthropic Example
7882
7983
```yaml
80-
name: AI Code Review with Advanced Settings
84+
name: AI Code Review with Anthropic
8185

8286
on:
8387
pull_request:
@@ -88,27 +92,22 @@ jobs:
8892
runs-on: ubuntu-latest
8993
steps:
9094
- name: AI Code Review
91-
uses: AleksandrFurmenkovOfficial/ai-code-review@v0.5
95+
uses: AleksandrFurmenkovOfficial/ai-code-review@v0.6
9296
with:
9397
token: ${{ secrets.GITHUB_TOKEN }}
9498
owner: ${{ github.repository_owner }}
9599
repo: ${{ github.event.repository.name }}
96100
pr_number: ${{ github.event.number }}
97-
98-
ai_provider: 'openai'
99-
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
100101

101-
include_extensions: '.py,.js,.tsx'
102-
exclude_extensions: '.test.js'
103-
include_paths: 'src/,app/'
104-
exclude_paths: 'test/,docs/'
105-
fail_action_if_review_failed: 'true'
102+
ai_provider: 'anthropic'
103+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
104+
anthropic_model: 'claude-3-7-sonnet-20250219'
106105
```
107106
108-
### Google Example (soon or suggest your PR to include)
107+
### Advanced Configuration Example
109108
110109
```yaml
111-
name: AI Code Review with Google
110+
name: AI Code Review with Advanced Settings
112111

113112
on:
114113
pull_request:
@@ -119,22 +118,27 @@ jobs:
119118
runs-on: ubuntu-latest
120119
steps:
121120
- name: AI Code Review
122-
uses: AleksandrFurmenkovOfficial/ai-code-review@v0.5
121+
uses: AleksandrFurmenkovOfficial/ai-code-review@v0.6
123122
with:
124123
token: ${{ secrets.GITHUB_TOKEN }}
125124
owner: ${{ github.repository_owner }}
126125
repo: ${{ github.event.repository.name }}
127126
pr_number: ${{ github.event.number }}
127+
128+
ai_provider: 'openai'
129+
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
128130

129-
ai_provider: 'google'
130-
google_api_key: ${{ secrets.GOOGLE_API_KEY }}
131-
google_model: 'gemini-2.0-flash-thinking-exp-01-21'
131+
include_extensions: '.py,.js,.tsx'
132+
exclude_extensions: '.test.js'
133+
include_paths: 'src/,app/'
134+
exclude_paths: 'test/,docs/'
135+
fail_action_if_review_failed: 'true'
132136
```
133137
134-
### Anthropic Example (soon or suggest your PR to include)
138+
### Google Example (soon or suggest your PR to include)
135139
136140
```yaml
137-
name: AI Code Review with Anthropic
141+
name: AI Code Review with Google
138142

139143
on:
140144
pull_request:
@@ -145,16 +149,16 @@ jobs:
145149
runs-on: ubuntu-latest
146150
steps:
147151
- name: AI Code Review
148-
uses: AleksandrFurmenkovOfficial/ai-code-review@v0.5
152+
uses: AleksandrFurmenkovOfficial/ai-code-review@main
149153
with:
150154
token: ${{ secrets.GITHUB_TOKEN }}
151155
owner: ${{ github.repository_owner }}
152156
repo: ${{ github.event.repository.name }}
153157
pr_number: ${{ github.event.number }}
154158

155-
ai_provider: 'anthropic'
156-
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
157-
anthropic_model: 'claude-3-5-sonnet-20241022'
159+
ai_provider: 'google'
160+
google_api_key: ${{ secrets.GOOGLE_API_KEY }}
161+
google_model: 'gemini-2.0-flash-thinking-exp-01-21'
158162
```
159163
160164
### Deepseek Example (soon or suggest your PR to include)
@@ -171,7 +175,7 @@ jobs:
171175
runs-on: ubuntu-latest
172176
steps:
173177
- name: AI Code Review
174-
uses: AleksandrFurmenkovOfficial/ai-code-review@v0.5
178+
uses: AleksandrFurmenkovOfficial/ai-code-review@main
175179
with:
176180
token: ${{ secrets.GITHUB_TOKEN }}
177181
owner: ${{ github.repository_owner }}
@@ -183,4 +187,24 @@ jobs:
183187
deepseek_model: 'deepseek-reasoner'
184188
```
185189
186-
PS. ***Written with/by AIs***
190+
## Troubleshooting
191+
192+
### Common Issues
193+
194+
#### API Key Issues
195+
- **Problem**: Error message about invalid API keys
196+
- **Solution**: Ensure your API keys are correctly set as GitHub secrets and properly passed to the workflow.
197+
198+
#### Action Failing with Timeout
199+
- **Problem**: The action fails with a timeout error
200+
- **Solution**:
201+
1. Try using a simpler or faster model
202+
2. Split large PRs into smaller ones
203+
3. Use include/exclude paths to limit the scope of the review
204+
205+
#### Error: "This model's maximum context length is exceeded"
206+
- **Problem**: The AI model can't process all the provided code due to token limitations
207+
- **Solution**:
208+
1. Use exclude_paths to skip large files
209+
2. Use include_extensions to focus only on critical file types
210+
3. Make smaller PRs with fewer changed files

action.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
name: 'AI Code Review'
2-
description: 'Perform code review using various AI models (OpenAI, Google, Anthropic, Deepseek)'
2+
description: 'Perform code review using various AI models (OpenAI, Anthropic, and soon Google, Deepseek)'
33

44
inputs:
55
token:
66
description: 'GitHub token'
77
required: true
88
ai_provider:
9-
description: 'AI provider to use (openai, google, anthropic, or deepseek)'
9+
description: 'AI provider to use (openai, anthropic, and soon google, deepseek)'
1010
required: true
1111
default: 'openai'
1212
openai_api_key:
1313
description: 'OpenAI API key (required if using OpenAI provider)'
1414
required: false
1515
openai_model:
16-
description: 'OpenAI model name (e.g., gpt-4o, o3-mini)'
16+
description: 'OpenAI model name (e.g., gpt-4o)'
1717
required: false
1818
default: 'gpt-4o'
19+
anthropic_api_key:
20+
description: 'Anthropic API key (required if using Anthropic provider)'
21+
required: false
22+
anthropic_model:
23+
description: 'Anthropic model name (e.g., claude-3-7-sonnet-20250219)'
24+
required: false
25+
default: 'claude-3-7-sonnet-latest'
1926
google_api_key:
2027
description: 'Google AI API key (required if using Google provider)'
2128
required: false
2229
google_model:
2330
description: 'Google model name (e.g., gemini-2.0-flash-thinking-exp-01-21)'
2431
required: false
2532
default: 'gemini-2.0-flash-thinking-exp-01-21'
26-
anthropic_api_key:
27-
description: 'Anthropic API key (required if using Anthropic provider)'
28-
required: false
29-
anthropic_model:
30-
description: 'Anthropic model name (e.g., claude-3-5-sonnet-20241022)'
31-
required: false
32-
default: 'claude-3-5-sonnet-20241022'
3333
deepseek_api_key:
3434
description: 'Deepseek API key (required if using Deepseek provider)'
3535
required: false
@@ -66,4 +66,4 @@ inputs:
6666
runs:
6767
using: 'node20'
6868
pre: 'setup.js'
69-
main: 'index.js'
69+
main: 'src/index.js'

0 commit comments

Comments
 (0)