mirror of
https://github.com/pacnpal/Claude-code-review.git
synced 2025-12-26 23:16:56 -05:00
Compare commits
2 Commits
v1.1
...
claude/upd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44d9ee380f | ||
|
|
9855ca990b |
159
README.md
159
README.md
@@ -1,12 +1,42 @@
|
|||||||
# Claude Code Review Action
|
# Claude Code Review Action
|
||||||
|
|
||||||
A GitHub Action that performs automated code reviews using Claude Sonnet 3.5, an AI assistant from Anthropic.
|

|
||||||
|

|
||||||
|
|
||||||
|
A GitHub Action that performs automated code reviews using Claude Sonnet 4.5, Anthropic's latest AI model for code analysis.
|
||||||
|
|
||||||
|
## Why Use Claude Code Review?
|
||||||
|
|
||||||
|
- **Instant Feedback**: Get AI-powered code reviews immediately on every pull request
|
||||||
|
- **Consistent Quality**: Apply consistent review standards across your entire codebase
|
||||||
|
- **Save Time**: Catch common issues before human review, allowing reviewers to focus on architecture and logic
|
||||||
|
- **Learn & Improve**: Get educational feedback that helps developers improve their coding skills
|
||||||
|
- **24/7 Availability**: Reviews happen automatically, even outside business hours
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
- [Why Use Claude Code Review?](#why-use-claude-code-review)
|
||||||
|
- [Features](#features)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Setup](#setup)
|
||||||
|
- [Inputs](#inputs)
|
||||||
|
- [Outputs](#outputs)
|
||||||
|
- [Review Format](#review-format)
|
||||||
|
- [Development](#development)
|
||||||
|
- [Contributing](#contributing)
|
||||||
|
- [License](#license)
|
||||||
|
- [Support](#support)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Analyzes code changes in pull requests
|
|
||||||
- Provides detailed feedback on code quality
|
- 🤖 **AI-Powered Reviews**: Leverages Claude Sonnet 4.5 for intelligent code analysis
|
||||||
- Identifies potential issues and suggests improvements
|
- 🔍 **Comprehensive Analysis**: Examines code changes in pull requests thoroughly
|
||||||
- Checks for security issues and best practices
|
- 💡 **Detailed Feedback**: Provides actionable feedback on code quality and structure
|
||||||
|
- 🐛 **Bug Detection**: Identifies potential issues and suggests improvements
|
||||||
|
- 🔒 **Security Scanning**: Checks for security vulnerabilities and risks
|
||||||
|
- ⚡ **Performance Insights**: Highlights performance implications of code changes
|
||||||
|
- 📋 **Best Practices**: Ensures adherence to coding standards and best practices
|
||||||
|
- 🎯 **Severity Ratings**: Categorizes issues by severity (Critical/High/Medium/Low)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -48,14 +78,39 @@ jobs:
|
|||||||
anthropic-key: ${{ secrets.ANTHROPIC_API_KEY }}
|
anthropic-key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||||
pr-number: ${{ github.event.pull_request.number || inputs.pr_number }}
|
pr-number: ${{ github.event.pull_request.number || inputs.pr_number }}
|
||||||
```
|
```
|
||||||
- Click on "Claude Code Review" Action under Actions tab.
|
### Manual Trigger
|
||||||
- Click "Run Workflow"
|
|
||||||
- Fill in branch and pull request ID and click "Run Workflow"
|
For existing pull requests, you can manually trigger the review:
|
||||||
|
|
||||||
|
1. Click on "Claude Code Review" Action under the Actions tab
|
||||||
|
2. Click "Run Workflow"
|
||||||
|
3. Fill in the branch and pull request number
|
||||||
|
4. Click "Run Workflow"
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
1. Create repository secret `ANTHROPIC_API_KEY` with your Claude API key from Anthropic
|
### Prerequisites
|
||||||
2. The `GITHUB_TOKEN` is automatically provided by GitHub Actions
|
|
||||||
|
- A GitHub repository
|
||||||
|
- An Anthropic API key ([Get one here](https://console.anthropic.com/))
|
||||||
|
- GitHub Actions enabled in your repository
|
||||||
|
|
||||||
|
### Configuration Steps
|
||||||
|
|
||||||
|
1. **Add Anthropic API Key**:
|
||||||
|
- Go to your repository Settings → Secrets and variables → Actions
|
||||||
|
- Click "New repository secret"
|
||||||
|
- Name: `ANTHROPIC_API_KEY`
|
||||||
|
- Value: Your Anthropic API key
|
||||||
|
- Click "Add secret"
|
||||||
|
|
||||||
|
2. **GitHub Token**:
|
||||||
|
- The `GITHUB_TOKEN` is automatically provided by GitHub Actions
|
||||||
|
- No additional configuration needed
|
||||||
|
|
||||||
|
3. **Set Permissions** (if needed):
|
||||||
|
- Ensure your workflow has proper permissions (see Usage example above)
|
||||||
|
- Required permissions: `contents: read` and `pull-requests: write`
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
@@ -109,23 +164,52 @@ Each issue found includes:
|
|||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
1. Clone the repository
|
### Local Development Setup
|
||||||
2. Install dependencies:
|
|
||||||
```bash
|
1. **Clone the repository**:
|
||||||
npm install
|
```bash
|
||||||
|
git clone https://github.com/pacnpal/claude-code-review.git
|
||||||
|
cd claude-code-review
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Install dependencies**:
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Make your changes**:
|
||||||
|
- Edit `action.js` for core functionality
|
||||||
|
- The built output goes to `dist/index.js`
|
||||||
|
|
||||||
|
4. **Build the action**:
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
This compiles `action.js` into `dist/index.js` using [@vercel/ncc](https://github.com/vercel/ncc)
|
||||||
|
|
||||||
|
5. **Run tests**:
|
||||||
|
```bash
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
claude-code-review/
|
||||||
|
├── action.js # Main action logic
|
||||||
|
├── action.yml # Action metadata
|
||||||
|
├── dist/ # Built output (committed)
|
||||||
|
│ └── index.js # Compiled action
|
||||||
|
├── package.json # Dependencies
|
||||||
|
└── README.md # Documentation
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Make changes to `action.js`
|
### Testing Changes
|
||||||
|
|
||||||
4. Build the action:
|
- Test your changes in a fork before submitting a PR
|
||||||
```bash
|
- Use the `workflow_dispatch` trigger for manual testing
|
||||||
npm run build
|
- Ensure `npm run build` completes without errors
|
||||||
```
|
- Verify all tests pass with `npm test`
|
||||||
|
|
||||||
5. Run tests:
|
|
||||||
```bash
|
|
||||||
npm test
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
@@ -143,6 +227,27 @@ MIT License - see the [LICENSE](LICENSE) file for details
|
|||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
- Open an issue for bugs/feature requests
|
### Getting Help
|
||||||
- Submit a PR to contribute
|
|
||||||
- Contact maintainers for other questions
|
- 🐛 **Bug Reports**: [Open an issue](https://github.com/pacnpal/claude-code-review/issues/new) with details and reproduction steps
|
||||||
|
- 💡 **Feature Requests**: [Create an issue](https://github.com/pacnpal/claude-code-review/issues/new) describing your use case
|
||||||
|
- 🤝 **Contributions**: Submit a PR following our contribution guidelines
|
||||||
|
- 📧 **Questions**: Open a discussion or contact the maintainers
|
||||||
|
|
||||||
|
### Resources
|
||||||
|
|
||||||
|
- [Anthropic Claude Documentation](https://docs.anthropic.com/)
|
||||||
|
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
|
||||||
|
- [Action Marketplace Listing](https://github.com/marketplace/actions/claude-code-review)
|
||||||
|
|
||||||
|
## Acknowledgments
|
||||||
|
|
||||||
|
Built with:
|
||||||
|
- [Anthropic Claude API](https://www.anthropic.com/claude) - AI-powered code analysis
|
||||||
|
- [GitHub Actions](https://github.com/features/actions) - CI/CD automation platform
|
||||||
|
- [@actions/core](https://github.com/actions/toolkit/tree/main/packages/core) - GitHub Actions toolkit
|
||||||
|
- [@vercel/ncc](https://github.com/vercel/ncc) - Node.js bundler
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Made with ❤️ by PacNPal** | [Report Bug](https://github.com/pacnpal/claude-code-review/issues) | [Request Feature](https://github.com/pacnpal/claude-code-review/issues)
|
||||||
|
|||||||
45
dist/index.js
vendored
45
dist/index.js
vendored
@@ -1882,6 +1882,7 @@ class Context {
|
|||||||
this.action = process.env.GITHUB_ACTION;
|
this.action = process.env.GITHUB_ACTION;
|
||||||
this.actor = process.env.GITHUB_ACTOR;
|
this.actor = process.env.GITHUB_ACTOR;
|
||||||
this.job = process.env.GITHUB_JOB;
|
this.job = process.env.GITHUB_JOB;
|
||||||
|
this.runAttempt = parseInt(process.env.GITHUB_RUN_ATTEMPT, 10);
|
||||||
this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
|
this.runNumber = parseInt(process.env.GITHUB_RUN_NUMBER, 10);
|
||||||
this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
|
this.runId = parseInt(process.env.GITHUB_RUN_ID, 10);
|
||||||
this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
|
this.apiUrl = (_a = process.env.GITHUB_API_URL) !== null && _a !== void 0 ? _a : `https://api.github.com`;
|
||||||
@@ -3557,11 +3558,11 @@ var __copyProps = (to, from, except, desc) => {
|
|||||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
|
||||||
// pkg/dist-src/index.js
|
// pkg/dist-src/index.js
|
||||||
var dist_src_exports = {};
|
var index_exports = {};
|
||||||
__export(dist_src_exports, {
|
__export(index_exports, {
|
||||||
Octokit: () => Octokit
|
Octokit: () => Octokit
|
||||||
});
|
});
|
||||||
module.exports = __toCommonJS(dist_src_exports);
|
module.exports = __toCommonJS(index_exports);
|
||||||
var import_universal_user_agent = __nccwpck_require__(3843);
|
var import_universal_user_agent = __nccwpck_require__(3843);
|
||||||
var import_before_after_hook = __nccwpck_require__(2732);
|
var import_before_after_hook = __nccwpck_require__(2732);
|
||||||
var import_request = __nccwpck_require__(8636);
|
var import_request = __nccwpck_require__(8636);
|
||||||
@@ -3569,13 +3570,28 @@ var import_graphql = __nccwpck_require__(7);
|
|||||||
var import_auth_token = __nccwpck_require__(7864);
|
var import_auth_token = __nccwpck_require__(7864);
|
||||||
|
|
||||||
// pkg/dist-src/version.js
|
// pkg/dist-src/version.js
|
||||||
var VERSION = "5.2.0";
|
var VERSION = "5.2.2";
|
||||||
|
|
||||||
// pkg/dist-src/index.js
|
// pkg/dist-src/index.js
|
||||||
var noop = () => {
|
var noop = () => {
|
||||||
};
|
};
|
||||||
var consoleWarn = console.warn.bind(console);
|
var consoleWarn = console.warn.bind(console);
|
||||||
var consoleError = console.error.bind(console);
|
var consoleError = console.error.bind(console);
|
||||||
|
function createLogger(logger = {}) {
|
||||||
|
if (typeof logger.debug !== "function") {
|
||||||
|
logger.debug = noop;
|
||||||
|
}
|
||||||
|
if (typeof logger.info !== "function") {
|
||||||
|
logger.info = noop;
|
||||||
|
}
|
||||||
|
if (typeof logger.warn !== "function") {
|
||||||
|
logger.warn = consoleWarn;
|
||||||
|
}
|
||||||
|
if (typeof logger.error !== "function") {
|
||||||
|
logger.error = consoleError;
|
||||||
|
}
|
||||||
|
return logger;
|
||||||
|
}
|
||||||
var userAgentTrail = `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
|
var userAgentTrail = `octokit-core.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
|
||||||
var Octokit = class {
|
var Octokit = class {
|
||||||
static {
|
static {
|
||||||
@@ -3649,15 +3665,7 @@ var Octokit = class {
|
|||||||
}
|
}
|
||||||
this.request = import_request.request.defaults(requestDefaults);
|
this.request = import_request.request.defaults(requestDefaults);
|
||||||
this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
|
this.graphql = (0, import_graphql.withCustomRequest)(this.request).defaults(requestDefaults);
|
||||||
this.log = Object.assign(
|
this.log = createLogger(options.log);
|
||||||
{
|
|
||||||
debug: noop,
|
|
||||||
info: noop,
|
|
||||||
warn: consoleWarn,
|
|
||||||
error: consoleError
|
|
||||||
},
|
|
||||||
options.log
|
|
||||||
);
|
|
||||||
this.hook = hook;
|
this.hook = hook;
|
||||||
if (!options.authStrategy) {
|
if (!options.authStrategy) {
|
||||||
if (!options.auth) {
|
if (!options.auth) {
|
||||||
@@ -4110,18 +4118,18 @@ var __copyProps = (to, from, except, desc) => {
|
|||||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
|
||||||
// pkg/dist-src/index.js
|
// pkg/dist-src/index.js
|
||||||
var dist_src_exports = {};
|
var index_exports = {};
|
||||||
__export(dist_src_exports, {
|
__export(index_exports, {
|
||||||
GraphqlResponseError: () => GraphqlResponseError,
|
GraphqlResponseError: () => GraphqlResponseError,
|
||||||
graphql: () => graphql2,
|
graphql: () => graphql2,
|
||||||
withCustomRequest: () => withCustomRequest
|
withCustomRequest: () => withCustomRequest
|
||||||
});
|
});
|
||||||
module.exports = __toCommonJS(dist_src_exports);
|
module.exports = __toCommonJS(index_exports);
|
||||||
var import_request3 = __nccwpck_require__(8636);
|
var import_request3 = __nccwpck_require__(8636);
|
||||||
var import_universal_user_agent = __nccwpck_require__(3843);
|
var import_universal_user_agent = __nccwpck_require__(3843);
|
||||||
|
|
||||||
// pkg/dist-src/version.js
|
// pkg/dist-src/version.js
|
||||||
var VERSION = "7.1.0";
|
var VERSION = "7.1.1";
|
||||||
|
|
||||||
// pkg/dist-src/with-defaults.js
|
// pkg/dist-src/with-defaults.js
|
||||||
var import_request2 = __nccwpck_require__(8636);
|
var import_request2 = __nccwpck_require__(8636);
|
||||||
@@ -4169,8 +4177,7 @@ function graphql(request2, query, options) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (const key in options) {
|
for (const key in options) {
|
||||||
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key))
|
if (!FORBIDDEN_VARIABLE_OPTIONS.includes(key)) continue;
|
||||||
continue;
|
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error(
|
new Error(
|
||||||
`[@octokit/graphql] "${key}" cannot be used as variable name`
|
`[@octokit/graphql] "${key}" cannot be used as variable name`
|
||||||
|
|||||||
Reference in New Issue
Block a user