Skip to content

Commit 1d18fd8

Browse files
committed
Update workflow permissions and enhance README with quick start guide
1 parent cb88d74 commit 1d18fd8

3 files changed

Lines changed: 58 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
pull_request:
55
types: [opened, synchronize]
66

7+
# Add required permissions
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
712
jobs:
813
test-pr-review:
914
runs-on: ubuntu-latest

README.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,36 @@ 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-
Example PR comment:
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
1844
1945
```markdown
20-
## OpenRouter AI Analysis
46+
## DiffGuard AI Analysis
2147

2248
### Potential Issues
2349

@@ -81,6 +107,11 @@ on:
81107
pull_request:
82108
types: [opened, synchronize]
83109

110+
# Required permissions
111+
permissions:
112+
contents: read
113+
pull-requests: write
114+
84115
jobs:
85116
review:
86117
runs-on: ubuntu-latest
@@ -130,6 +161,11 @@ on:
130161
pull_request:
131162
types: [opened, synchronize]
132163
164+
# Required permissions
165+
permissions:
166+
contents: read
167+
pull-requests: write
168+
133169
jobs:
134170
review:
135171
runs-on: ubuntu-latest
@@ -190,6 +226,20 @@ Recommended models:
190226
- Always use GitHub Secrets
191227
7. The action will run automatically on your PR and post its analysis as a comment
192228

229+
## Troubleshooting
230+
231+
### Permission Errors
232+
233+
If you see `Error: Resource not accessible by integration`, add these permissions to your workflow:
234+
235+
```yaml
236+
permissions:
237+
contents: read
238+
pull-requests: write
239+
```
240+
241+
This allows the action to read PR contents and create comments.
242+
193243
## Security Best Practices
194244

195245
1. Always use GitHub Secrets for sensitive data

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async function createPRComment(octokit, context, analysis) {
8888
owner: context.repo.owner,
8989
repo: context.repo.repo,
9090
issue_number: context.payload.pull_request.number,
91-
body: `## OpenRouter AI Analysis
91+
body: `## DiffGuard AI Analysis
9292
9393
${analysis}
9494

0 commit comments

Comments
 (0)