27 Commits

Author SHA1 Message Date
pacnpal
d1c6a98994 Update action.js 2025-02-10 17:08:21 -05:00
github-actions[bot]
e6777037d5 Add built files 2025-02-10 21:57:17 +00:00
pacnpal
c6c00d8c95 Update release.yml 2025-02-10 16:56:24 -05:00
pacnpal
45e3331bcb Update release.yml 2025-02-10 16:50:17 -05:00
pacnpal
dd1b18e57a Update release.yml 2025-02-10 16:47:22 -05:00
pacnpal
1b84aff159 Update action.js 2025-02-10 16:18:34 -05:00
pacnpal
5fb151d172 Update release.yml 2025-02-10 16:09:39 -05:00
pacnpal
4e1bd4b9e5 Merge pull request #5 from pacnpal/pacnpal-patch-1
Update README.md
2025-02-10 16:06:21 -05:00
pacnpal
7276f1e2c5 Update README.md 2025-02-10 16:06:09 -05:00
pacnpal
2c57b7a5ba Update release.yml 2025-02-10 16:05:18 -05:00
pacnpal
096a52cda5 Merge pull request #4 from pacnpal/pacnpal-patch-1
Update README.md
2025-02-10 15:11:02 -05:00
pacnpal
0356960aa8 Update README.md 2025-02-10 15:10:43 -05:00
pacnpal
a5bd0e4bcf Update README.md 2025-02-10 15:02:22 -05:00
pacnpal
e49cf9d908 Merge pull request #3 from pacnpal/pacnpal-patch-1
Update README.md
2025-02-10 14:57:39 -05:00
pacnpal
a4b8566177 Update README.md 2025-02-10 14:55:38 -05:00
pacnpal
fc5d87701c Update action.js 2025-02-10 14:52:55 -05:00
pacnpal
eb556a6d23 Update README.md 2025-02-10 13:35:39 -05:00
pacnpal
7e5914e90c Update README.md 2025-02-10 13:28:43 -05:00
pacnpal
6c6cbaba84 Update README.md 2025-02-10 13:28:03 -05:00
pacnpal
9f9953664f Merge pull request #2 from pacnpal/dependabot/npm_and_yarn/npm_and_yarn-2c579f9325 2025-01-21 21:57:04 -05:00
dependabot[bot]
ada4f6b4ed Bump undici in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 1 update in the / directory: [undici](https://github.com/nodejs/undici).


Updates `undici` from 5.28.4 to 5.28.5
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.4...v5.28.5)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-22 00:48:58 +00:00
pacnpal
a5a4083f00 Update README.md 2024-12-24 11:15:26 -05:00
pacnpal
782f8cccd0 Update README.md 2024-12-24 10:58:45 -05:00
pacnpal
6a73dbfff6 Update README.md 2024-12-24 10:56:46 -05:00
pacnpal
52219d4d98 Update README.md 2024-12-24 10:53:19 -05:00
pacnpal
c555f5511a fix 2024-12-10 18:57:57 -05:00
pacnpal
bd3279eb92 Include built dist directory 2024-12-10 18:56:19 -05:00
6 changed files with 32090 additions and 36 deletions

View File

@@ -25,6 +25,14 @@ jobs:
- name: Build
run: npm run build
- name: Commit built files
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add -f dist
git commit -m 'Add built files'
git push origin HEAD:main
- name: Create Release
uses: softprops/action-gh-release@v1
with:

View File

@@ -1,6 +1,6 @@
# Claude Code Review Action
A GitHub Action that performs automated code reviews using Claude AI.
A GitHub Action that performs automated code reviews using Claude Sonnet 3.5, an AI assistant from Anthropic.
## Features
- Analyzes code changes in pull requests
@@ -13,29 +13,44 @@ A GitHub Action that performs automated code reviews using Claude AI.
Add this to your GitHub workflow file (e.g. `.github/workflows/review.yml`):
```yaml
name: Code Review
name: Claude Code Review
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
on:
# Run on new/updated PRs
pull_request:
types: [opened, reopened, synchronize]
# Allow manual triggers for existing PRs
workflow_dispatch:
inputs:
pr_number:
description: 'Pull Request Number'
required: true
type: string
jobs:
code-review:
runs-on: ubuntu-latest
environment: development_environment
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: your-username/claude-code-review-action@v1
- name: Run Claude Review
uses: pacnpal/claude-code-review@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
anthropic-key: ${{ secrets.ANTHROPIC_API_KEY }}
pr-number: ${{ github.event.pull_request.number }}
pr-number: ${{ github.event.pull_request.number || inputs.pr_number }}
```
- Click on "Claude Code Review" Action under Actions tab.
- Click "Run Workflow"
- Fill in branch and pull request ID and click "Run Workflow"
## Setup

View File

@@ -48,26 +48,7 @@ async function getDiff(baseSha, headSha) {
}
});
// Filter for relevant files
const lines = diffContent.split('\n');
let filtered = '';
let keep = false;
for (const line of lines) {
if (line.startsWith('diff --git')) {
keep = false;
// Check if file type should be included
if (line.match(/\.(js|ts|py|cpp|h|java|cs)$/) &&
!line.match(/(package-lock\.json|yarn\.lock|\.md|\.json)/)) {
keep = true;
}
}
if (keep) {
filtered += line + '\n';
}
}
return filtered;
return diffContent;
} catch (error) {
throw new Error(`Failed to generate diff: ${error.message}`);
}
@@ -94,7 +75,9 @@ For each issue found:
- Provide specific recommendations for fixes
- Include code examples where helpful
If no issues are found in a particular area, explicitly state that.
- If no issues are found in a particular area, explicitly state that.
- If it's a dependency update, evaluate with strict scrutiny the implications of the change.
- No matter your findings, give a summary of the pull request.
Here is the code diff to review:
@@ -111,7 +94,7 @@ ${diffContent}
'anthropic-version': '2023-06-01'
},
body: JSON.stringify({
model: 'claude-3-sonnet-20240229',
model: 'claude-3-5-sonnet-20241022',
max_tokens: 4096,
temperature: 0.7,
messages: [{

View File

@@ -18,4 +18,4 @@ outputs:
description: 'Generated code review'
runs:
using: 'node20'
main: 'action.js'
main: 'dist/index.js'

32046
dist/index.js vendored Normal file

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@@ -3241,7 +3241,9 @@
}
},
"node_modules/undici": {
"version": "5.28.4",
"version": "5.28.5",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
"license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"