Skip to content

Commit 322cab0

Browse files
Merge pull request #9 from bishalprasad321/develop
Release developed changes to main
2 parents 4beacbf + e4b5004 commit 322cab0

19 files changed

Lines changed: 661 additions & 661 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @bishalprasad321

.github/workflows/action-test.yml

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
github_token: ${{ secrets.GITHUB_TOKEN }}
7070
llm_api_key: ${{ secrets.GROQ_API_KEY }}
7171
llm_provider: groq
72-
ai_model: groq-1.5-mini
72+
ai_model: openai/gpt-oss-120b
7373
max_diff_lines: "5000"
7474
enable_incremental_diff_processing: "true"
7575
debug: ${{ inputs.debug_enabled || 'false' }}
@@ -207,67 +207,3 @@ jobs:
207207
echo " - LLM API is temporarily unavailable"
208208
fi
209209
echo "=========================================="
210-
211-
# ============================================================================
212-
# Integration Test Summary
213-
# ============================================================================
214-
# Summarize both steps and provide overall status
215-
# ============================================================================
216-
test-summary:
217-
name: "Integration Test Summary"
218-
needs: [generate-description, consensus-review]
219-
runs-on: ubuntu-latest
220-
if: always()
221-
222-
steps:
223-
- name: Checkout code
224-
uses: actions/checkout@v4
225-
226-
- name: Create Integration Test Report
227-
uses: actions/github-script@v7
228-
if: github.event_name == 'pull_request'
229-
with:
230-
script: |
231-
const generateDescStatus = '${{ needs.generate-description.result }}';
232-
const consensusReviewStatus = '${{ needs.consensus-review.result }}';
233-
234-
let reportBody = '## 🤖 AI Review Workflow Report\n\n';
235-
reportBody += '### Step 1: PR Description Generation\n';
236-
reportBody += `- Status: ${generateDescStatus === 'success' ? '✅ Success' : '⚠️ ' + generateDescStatus}\n\n`;
237-
238-
reportBody += '### Step 2: Multi-Model Consensus Review\n';
239-
reportBody += `- Status: ${consensusReviewStatus === 'success' ? '✅ Success' : '⚠️ ' + consensusReviewStatus}\n`;
240-
reportBody += `- Decision: ${{ needs.consensus-review.outputs.review_decision || 'N/A' }}\n`;
241-
reportBody += `- Consensus Round: ${{ needs.consensus-review.outputs.consensus_round || 'N/A' }}\n\n`;
242-
243-
reportBody += '### Workflow Status\n';
244-
const allSuccess = generateDescStatus === 'success' && consensusReviewStatus === 'success';
245-
reportBody += allSuccess
246-
? '✅ **All steps completed successfully**\n'
247-
: '⚠️ **One or more steps encountered issues** (check logs for details)\n';
248-
249-
reportBody += '\n---\n';
250-
reportBody += '*Models Used:* Review [MODELS_AND_OPTIMIZATION.md](../../MODELS_AND_OPTIMIZATION.md) for configuration details\n';
251-
reportBody += '*This report was generated by the PR Pilot Review Integration Tests*\n';
252-
253-
console.log(reportBody);
254-
255-
- name: Print Workflow Summary
256-
run: |
257-
echo "=========================================="
258-
echo "Integration Test Workflow Summary"
259-
echo "=========================================="
260-
echo ""
261-
echo "Jobs Status:"
262-
echo " Generate Description: ${{ needs.generate-description.result }}"
263-
echo " Consensus Review: ${{ needs.consensus-review.result }}"
264-
echo ""
265-
echo "Consensus Review Outputs:"
266-
echo " Decision: ${{ needs.consensus-review.outputs.review_decision }}"
267-
echo " Round: ${{ needs.consensus-review.outputs.consensus_round }}"
268-
echo " Review ID: ${{ needs.consensus-review.outputs.review_id }}"
269-
echo ""
270-
echo "💡 Tips:"
271-
echo " - Run with debug_enabled=true for verbose model output"
272-
echo " - Try different model presets for cost/quality trade-offs"
273-
echo " - See MODELS_AND_OPTIMIZATION.md for detailed configuration"

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Create a Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*" # Trigger on tags like v1.0.0, v2.1.3, etc.
7+
8+
jobs:
9+
create-release:
10+
name: Create Release
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Create Release
20+
id: create_release
21+
uses: actions/create-release@latest
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
with:
25+
tag_name: ${{ github.ref_name }}
26+
release_name: ${{ github.ref_name }}
27+
draft: false
28+
prerelease: false
29+
30+
update-majorver:
31+
name: Update Major Version
32+
runs-on: ubuntu-latest
33+
needs: create-release
34+
permissions:
35+
contents: write
36+
37+
steps:
38+
- name: Update Major Version Tag
39+
uses: nowactions/update-majorver@v1

CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributing to PR Pilot Review
2+
3+
We welcome contributions to the PR Pilot Review project! Whether you're fixing bugs, improving documentation, or proposing new features, your help is appreciated.
4+
5+
## Getting Started
6+
7+
1. **Fork the repository** on GitHub.
8+
2. **Clone your fork** locally:
9+
```bash
10+
git clone https://github.com/your-username/prpilot-review.git
11+
cd prpilot-review
12+
```
13+
3. **Add the upstream remote**:
14+
```bash
15+
git remote add upstream https://github.com/bishalprasad321/prpilot-review.git
16+
```
17+
18+
## Development Process
19+
20+
Please refer to the [Development Guide](DEVELOPMENT.md) for detailed instructions on setting up your local environment, available scripts, and testing procedures.
21+
22+
### Workflow
23+
24+
1. Ensure your local `main` branch is up to date with the `upstream` repository.
25+
2. **Create a feature branch**:
26+
```bash
27+
git checkout -b feature/your-feature-name
28+
```
29+
3. **Make your changes**. Keep your commits focused and provide clear, descriptive commit messages.
30+
4. **Test thoroughly**. Run the full suite of checks to ensure your changes meet the project's quality standards:
31+
```bash
32+
npm run all
33+
```
34+
5. **Build the distributable**. The GitHub Action consumes the compiled bundle in the `dist/` directory. You must rebuild it before committing:
35+
```bash
36+
npm run build
37+
git add dist/
38+
```
39+
6. **Commit your changes**:
40+
```bash
41+
git commit -m "Brief description of the changes"
42+
```
43+
7. **Push to your fork**:
44+
```bash
45+
git push origin feature/your-feature-name
46+
```
47+
48+
## Pull Request Guidelines
49+
50+
- **Open a Pull Request** against the `main` or `develop` branch of the upstream repository.
51+
- **Describe your changes** clearly in the PR description. Detail what was changed, why it was changed, and any related issue numbers.
52+
- Ensure all CI status checks pass. If tests fail, investigate and fix the underlying issues.
53+
- Be prepared to discuss your code and address review feedback.
54+
55+
## Code Standards
56+
57+
- **TypeScript**: The project is written in TypeScript. Ensure all new code is strongly typed and passes the `npm run typecheck` validation.
58+
- **Formatting**: We use Prettier for consistent code formatting. Run `npm run format` before committing.
59+
- **Linting**: We use ESLint to catch potential errors and enforce code style. Address any warnings or errors reported by `npm run lint`.
60+
- **Testing**: Include tests for new features and bug fixes. Existing tests must not be broken by your changes.
61+
62+
Thank you for contributing!

DEVELOPMENT.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Development Guide
2+
3+
This guide outlines how to set up the PR Pilot Review project for local development, run tests, and build the action.
4+
5+
## Prerequisites
6+
7+
Ensure you have the following installed on your development machine:
8+
9+
- Node.js (Version 20 or higher)
10+
- npm (Version 10 or higher)
11+
- Git
12+
13+
## Initial Setup
14+
15+
1. Clone the repository:
16+
17+
```bash
18+
git clone https://github.com/bishalprasad321/prpilot-review.git
19+
cd prpilot-review
20+
```
21+
22+
2. Install project dependencies:
23+
```bash
24+
npm install
25+
```
26+
27+
## Development Workflow
28+
29+
The source code is located in the `src/` directory. The project uses TypeScript.
30+
31+
### Available Scripts
32+
33+
The following npm scripts are available for development:
34+
35+
- `npm run typecheck`: Validates TypeScript types.
36+
- `npm run lint`: Runs ESLint to check for code quality issues.
37+
- `npm run format`: Automatically fixes formatting issues using Prettier.
38+
- `npm run test`: Runs the Jest test suite.
39+
- `npm run build`: Bundles the action using `@vercel/ncc` into the `dist/` directory.
40+
- `npm run verify`: Verifies the generated bundle.
41+
- `npm run all`: Runs formatting, linting, typechecking, tests, and the build process sequentially.
42+
43+
### Making Changes
44+
45+
1. Create a new branch for your feature or bugfix:
46+
```bash
47+
git checkout -b feature/your-feature-name
48+
```
49+
2. Make your modifications within the `src/` directory.
50+
3. Ensure your code passes all checks:
51+
```bash
52+
npm run all
53+
```
54+
4. **Important**: The GitHub Action runs from the compiled `dist/index.js` file. You must build the project and commit the `dist/` directory for your changes to take effect in the action.
55+
```bash
56+
npm run build
57+
git add dist/
58+
git commit -m "Build dist bundle"
59+
```
60+
61+
## Testing
62+
63+
### Local Testing
64+
65+
The project uses Jest for unit testing. You can run the tests locally:
66+
67+
```bash
68+
npm test # Run all tests
69+
npm test -- --watch # Run tests in watch mode
70+
npm test -- --coverage # Generate a coverage report
71+
```
72+
73+
### Integration Testing
74+
75+
Integration tests are defined in `.github/workflows/action-test.yml`. You can trigger these manually via the GitHub Actions UI:
76+
77+
1. Navigate to the **Actions** tab in your repository.
78+
2. Select the **Test Action - Multi-Model Consensus Review Integration** workflow.
79+
3. Click **Run workflow**. You can configure options like `debug_enabled` and `model_preset` before running.
80+
81+
### Testing on a Pull Request
82+
83+
To test your changes in a real PR environment:
84+
85+
1. Push your branch and create a Pull Request against the `develop` or `main` branch.
86+
2. The action will automatically run against your PR if the workflow is configured.
87+
3. Review the action logs and the generated PR comments to verify behavior.

QUICKSTART.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Quick Start Guide
2+
3+
This guide will help you integrate PR Pilot Review into your GitHub repository to enable automated, multi-model consensus code reviews.
4+
5+
## Prerequisites
6+
7+
Before setting up the action, you need an API key from a supported LLM provider.
8+
9+
1. **Choose your LLM provider:** The action currently supports `gemini` and `groq`.
10+
2. **Obtain an API key:** Register or log in to your chosen provider's platform to generate an API key.
11+
- For Gemini: Google AI Studio
12+
- For Groq: Groq Console
13+
14+
## Configuration Steps
15+
16+
### 1. Add the API key to GitHub Secrets
17+
18+
You need to store your API key securely in your GitHub repository.
19+
20+
1. Navigate to your repository on GitHub.
21+
2. Go to **Settings** > **Secrets and variables** > **Actions**.
22+
3. Click **New repository secret**.
23+
4. Name the secret appropriately (e.g., `GROQ_API_KEY` or `GEMINI_API_KEY`).
24+
5. Paste your API key as the secret value and save.
25+
26+
### 2. Enable GitHub Actions to Approve Pull Requests
27+
28+
For the bot to successfully submit an "APPROVE" or "REQUEST_CHANGES" review decision, you must explicitly grant this permission in your repository settings.
29+
30+
1. Navigate to your repository on GitHub.
31+
2. Go to **Settings** > **Actions** > **General**.
32+
3. Scroll down to the **Workflow permissions** section.
33+
4. Ensure the checkbox for **Allow GitHub Actions to create and approve pull requests** is checked.
34+
5. Click **Save**.
35+
36+
_(Note: If this setting is not enabled, the action will still be able to post regular comments, but may fail when attempting to submit a formal approval or change request)._
37+
38+
### 3. Set up the Workflow File
39+
40+
Create a new file in your repository at `.github/workflows/ai-review.yml` and add the following configuration:
41+
42+
```yaml
43+
name: AI Code Review
44+
45+
on:
46+
pull_request:
47+
branches: [main, develop]
48+
49+
jobs:
50+
ai-review:
51+
name: Multi-Model AI Review
52+
runs-on: ubuntu-latest
53+
54+
permissions:
55+
pull-requests: write
56+
contents: read
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- uses: bishalprasad321/prpilot-review@v1
62+
with:
63+
github_token: ${{ secrets.GITHUB_TOKEN }}
64+
llm_provider: groq
65+
llm_api_key: ${{ secrets.GROQ_API_KEY }}
66+
67+
# Optional: Use Groq's OpenAI-compatible API
68+
llm_provider_url: https://api.groq.com/openai/v1
69+
```
70+
71+
### 3. Advanced Configuration (Optional)
72+
73+
You can customize the models used for review and the behavior of the action.
74+
75+
```yaml
76+
- uses: bishalprasad321/prpilot-review@v1
77+
with:
78+
github_token: ${{ secrets.GITHUB_TOKEN }}
79+
llm_provider: groq
80+
llm_api_key: ${{ secrets.GROQ_API_KEY }}
81+
llm_provider_url: https://api.groq.com/openai/v1
82+
83+
# Customize model configuration
84+
reviewer_models: "llama-3.1-8b-instant,openai/gpt-oss-20b,llama-3.3-70b-versatile"
85+
judge_model: "openai/gpt-oss-120b"
86+
87+
# Adjust consensus parameters
88+
max_consensus_rounds: "3"
89+
90+
# Feature toggles
91+
inline_comments_enabled: "true"
92+
max_diff_lines: "5000"
93+
enable_incremental_diff_processing: "true"
94+
```
95+
96+
For more detailed information on inputs, outputs, and configuration options, please refer to the [API Reference](docs/api.md).

0 commit comments

Comments
 (0)