Skip to content

Commit e130c1c

Browse files
committed
Fix
1 parent 0302832 commit e130c1c

2 files changed

Lines changed: 66 additions & 76 deletions

File tree

README.md

Lines changed: 52 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -14,73 +14,6 @@ AI-powered PR reviews using OpenRouter's language models. Get automated code rev
1414
- Best practices violations
1515
- Overall score and final comments
1616

17-
## Quick Start
18-
19-
Add this workflow to `.github/workflows/pr-review.yml`:
20-
21-
```yaml
22-
name: PR Review
23-
on:
24-
pull_request:
25-
types: [opened, synchronize]
26-
27-
# Add these permissions to allow PR comments
28-
permissions:
29-
contents: read
30-
pull-requests: write
31-
32-
jobs:
33-
review:
34-
runs-on: ubuntu-latest
35-
steps:
36-
- uses: actions/checkout@v3
37-
- uses: jonit-dev/openrouter-github-action@main
38-
with:
39-
github_token: ${{ secrets.GITHUB_TOKEN }}
40-
open_router_key: ${{ secrets.OPEN_ROUTER_KEY }}
41-
```
42-
43-
## Example PR Comment
44-
45-
```markdown
46-
## DiffGuard AI Analysis
47-
48-
### Potential Issues
49-
50-
- The database query in `users.service.ts` isn't properly parameterized, creating a SQL injection risk
51-
- Async operation in `handleSubmit()` lacks error handling
52-
53-
### Improvements Suggested
54-
55-
- Consider using prepared statements for database queries
56-
- Add try/catch block around async operations
57-
- Extract form validation logic into a separate utility
58-
59-
### Performance
60-
61-
- The `heavyComputation()` function could benefit from memoization
62-
- Consider lazy loading for the imported analytics module
63-
64-
### Security Concerns
65-
66-
- API endpoint lacks input validation
67-
- Sensitive data exposure in error logs
68-
69-
### Best Practices
70-
71-
- Follow consistent naming convention for interface props
72-
- Add type annotations for function parameters
73-
- Consider breaking down large component into smaller ones
74-
75-
### Overall score
76-
77-
⭐⭐⭐⭐ (4/5) - Good PR with some minor improvements needed. The code is well-structured but could benefit from additional security measures and error handling.
78-
79-
---
80-
81-
_Analyzed using anthropic/claude-2_
82-
```
83-
8417
## ⚠️ Security First: Managing Secrets
8518

8619
This action requires an OpenRouter API key. **NEVER** commit API keys or sensitive data directly in your workflow files.
@@ -141,6 +74,58 @@ jobs:
14174
Provide a 1-5 star rating for the overall quality.
14275
```
14376
77+
## Building the Project
78+
79+
After making changes to the action's code, you need to build the project to update the action:
80+
81+
1. Run the following command to install dependencies and build the action:
82+
```bash
83+
npm install && npm run build
84+
```
85+
86+
This will compile the code and prepare it for use in GitHub Actions.
87+
88+
## Example PR Comment
89+
90+
```markdown
91+
## OpenRouter AI Analysis
92+
93+
### Potential Issues
94+
95+
- The database query in `users.service.ts` isn't properly parameterized, creating a SQL injection risk
96+
- Async operation in `handleSubmit()` lacks error handling
97+
98+
### Improvements Suggested
99+
100+
- Consider using prepared statements for database queries
101+
- Add try/catch block around async operations
102+
- Extract form validation logic into a separate utility
103+
104+
### Performance
105+
106+
- The `heavyComputation()` function could benefit from memoization
107+
- Consider lazy loading for the imported analytics module
108+
109+
### Security Concerns
110+
111+
- API endpoint lacks input validation
112+
- Sensitive data exposure in error logs
113+
114+
### Best Practices
115+
116+
- Follow consistent naming convention for interface props
117+
- Add type annotations for function parameters
118+
- Consider breaking down large component into smaller ones
119+
120+
### Overall score
121+
122+
⭐⭐⭐⭐ (4/5) - Good PR with some minor improvements needed. The code is well-structured but could benefit from additional security measures and error handling.
123+
124+
---
125+
126+
_Analyzed using anthropic/claude-2_
127+
```
128+
144129
## Configuration Reference
145130

146131
| Input | Description | Required | Default | Notes |

src/index.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,31 @@ Do not mention what's good on the code. Just focus on what's bad and how to impr
2828
2929
Analyze the following code changes and provide a detailed review in the following format. MAKE SURE TO ADHERE TO THIS FORMAT!
3030
31-
### Overall score
31+
For each category below, except for the overall score, rate the issue in terms of severity (low, medium, high).
32+
33+
Here's your text with added emojis:
34+
35+
---
36+
37+
### 🏆 Overall Score
3238
[Give a 1-5 star rating for this PR] and final comments
3339
34-
### Potential Issues
40+
### 🐞 Potential Issues
3541
[List any bugs, vulnerabilities, or critical issues]
3642
37-
### Improvements Suggested
43+
### 💡 Improvements Suggested
3844
[List specific code improvements and refactoring suggestions]
3945
40-
### Performance
46+
### ⚡️ Performance
4147
[Discuss performance implications and optimization opportunities]
4248
43-
### Security Concerns
49+
### 🔐 Security Concerns
4450
[List security issues, if any]
4551
46-
### Best Practices
47-
[Suggest adherence to coding standards and best practices]
48-
52+
### 📏 Best Practices
53+
[Suggest adherence to coding standards and best practices]
4954
50-
Please be specific and provide actionable feedback.`;
55+
Please be specific and provide actionable feedback. No generic BS advice.`;
5156

5257
const prompt = customPrompt || defaultPrompt;
5358
const fullPrompt = `${prompt}\n\nHere's the diff:\n${diff}\n\nProvide your analysis in the specified format.`;

0 commit comments

Comments
 (0)