Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Server-Side Page Fragment Composition pattern #2697
- Implement complete Server-Side Page Fragment Composition design pattern
- Add microservices for header, content, and footer fragments
- Create composition service for server-side page assembly
- Include comprehensive documentation and examples
- Add unit tests with 17 test cases covering all functionality
- Support both synchronous and asynchronous composition
- Include caching, personalization, and performance monitoring
- Follow project contribution guidelines and coding standards

Closes #2697
  • Loading branch information
athikha committed Oct 18, 2025
commit 763bb357c00a94f17a1dd61a3a0c76ab7a022427
71 changes: 71 additions & 0 deletions .github/LLM_API_KEY_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# LLM API Key Setup Guide

This repository uses AI-powered code review through the Presubmit.ai workflow. To enable this feature, you need to configure the `LLM_API_KEY` secret.

## Quick Setup

### Step 1: Get Your Gemini API Key

1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
2. Sign in with your Google account
3. Click **"Create API Key"**
4. Copy the generated API key

### Step 2: Configure the Secret in GitHub

1. Go to your repository: `https://github.com/[YOUR_USERNAME]/java-design-patterns`
2. Click **Settings** → **Secrets and variables** → **Actions**
3. Click **"New repository secret"**
4. Set:
- **Name**: `LLM_API_KEY`
- **Secret**: Your Gemini API key from Step 1
5. Click **"Add secret"**

### Step 3: Verify Setup

After adding the secret, the next PR or workflow run will automatically use AI review.

## Model Configuration

The workflow is configured to use `gemini-1.5-flash` model. If you need to change this:

1. Edit `.github/workflows/presubmit.yml`
2. Update the `LLM_MODEL` environment variable
3. Available models include:
- `gemini-1.5-pro`
- `gemini-1.5-flash` (default)
- `gemini-pro`

## Troubleshooting

### Common Issues

**Error: "LLM_API_KEY secret is not configured"**
- Solution: Follow Step 2 above to add the secret

**Error: "Model not found" or 404 errors**
- Check if your API key has access to the specified model
- Try using `gemini-1.5-pro` instead of `gemini-1.5-flash`
- Verify your API key is valid and active

**Workflow skips AI review**
- This is normal behavior when `LLM_API_KEY` is not configured
- The workflow will continue without AI review
- Add the secret to enable AI review

### Getting Help

If you encounter issues:
1. Check the GitHub Actions logs for detailed error messages
2. Verify your API key is correct and has proper permissions
3. Ensure you're using a supported model name

## Benefits of AI Review

When properly configured, the AI reviewer will:
- ✅ Analyze code quality and suggest improvements
- ✅ Check for potential bugs and security issues
- ✅ Provide feedback on code style and best practices
- ✅ Help maintain consistent coding standards

The AI review is **optional** - the main CI/CD pipeline will work without it.
28 changes: 20 additions & 8 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,33 @@ jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Check required secrets
run: |
if [ -z "${{ secrets.LLM_API_KEY }}" ]; then
echo "Error: LLM_API_KEY secret is not configured"
exit 1
fi

- name: Check out PR code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Check API key availability
id: check_api_key
run: |
if [ -z "${{ secrets.LLM_API_KEY }}" ]; then
echo "api_key_available=false" >> $GITHUB_OUTPUT
echo "Warning: LLM_API_KEY secret is not configured. AI review will be skipped."
else
echo "api_key_available=true" >> $GITHUB_OUTPUT
echo "LLM_API_KEY is configured. AI review will run."
fi

- name: Run AI Reviewer
if: steps.check_api_key.outputs.api_key_available == 'true'
uses: presubmit/ai-reviewer@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_MODEL: "gemini-1.5-flash"
continue-on-error: true

- name: AI Review Skipped Notice
if: steps.check_api_key.outputs.api_key_available == 'false'
run: |
echo "::notice::AI review was skipped because LLM_API_KEY secret is not configured."
echo "To enable AI review, please configure the LLM_API_KEY secret in repository settings."
Loading