This action uses the Repomix library to generate a comprehensive text representation of your codebase and optionally submits it to Google Gemini with selected prompt. This allows you to:
- Create a single document containing your entire codebase in a format suitable for LLM analysis
- Analyze your code with predefined or custom prompts through Google Gemini
- π€ AI-Powered Code Audits: Integrate with Google Gemini for intelligent code analysis and insights
- π Default Analysis Prompts: 8 pre-built prompts covering architecture, SOLID principles, security, testing, and more
- π― Custom Prompt Support: Create and use your own custom analysis prompts from
.codeaudits/promptsdirectory - π» Local Development: Run the tool locally outside of GitHub Actions for faster development cycles
- β‘ Updated Dependencies: Upgraded to Repomix v1.2.0 for improved parsing performance and reliability
- π Enhanced Examples: More comprehensive GitHub Actions configuration examples and use cases
Add the following to your GitHub Actions workflow file:
name: CodeAudits Analysis
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Or use workflow_dispatch to trigger manually
workflow_dispatch:
jobs:
analyze:
runs-on: ubuntu-latest
name: Analyze code with CodeAudits
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for thorough analysis
- name: Parse and submit repository
uses: codeaudits/codeaudits-action@v1
id: audit
with:
style: markdown # Format of the parsed output
compress: true # Enable intelligent code parsing to reduce tokens (default: false)
llm-prompt: architecture-refactoring # Optional: AI analysis prompt
gemini-api-key: ${{ secrets.GEMINI_API_KEY }} # Optional: for AI analysis
- name: Upload parsed file as artifact
uses: actions/upload-artifact@v4
with:
name: codebase-analysis
path: parsed-repo.txt| Input | Description | Default | Required |
|---|---|---|---|
style |
Parsed document style. Use 'markdown', 'xml' or 'plain' (it's Repomix config option) | markdown |
No |
compress |
Run intelligent code parsing to reduce tokens (it's Repomix config option) | false |
No |
working-directory |
The directory in which to run the action. Defaults to the repository root | . |
No |
llm-prompt |
The name of the prompt file for the Gemini prompt (see Available Prompts) | No | |
llm-custom-prompt |
The name of the custom prompt file from /.codeaudits/prompts directory in your repository |
No | |
gemini-api-key |
Gemini API key for AI-powered code analysis | No |
When using the llm-prompt input, you can choose from the following predefined prompt files:
architecture-refactoring- Analysis focused on architectural improvements and refactoring opportunitiesdry-kiss-yagni- Review based on DRY, KISS, and YAGNI principlesessential-software-patterns- Analysis of software design patterns usagefunctionalities-analysis- Comprehensive functionality and feature analysismissing-tests- Identification of missing test coverage and testing opportunitiespossible-bugs- Detection of potential bugs and code issuessimplification-hints- Suggestions for code simplification and optimizationsolid- Review based on SOLID principles
Note: If you provide an invalid prompt name, the action will fail with a helpful error message listing all available options.
In addition to the predefined prompts, you can create and use custom prompts by:
- Creating a
/.codeaudits/promptsdirectory in your repository - Adding your custom prompt file (e.g.,
my-custom-analysis.md) - Using the
llm-custom-promptinput with the filename
Example custom prompt file structure:
your-repository/
βββ .codeaudits/
β βββ prompts/
β βββ performance-analysis.md
β βββ security-review.md
β βββ api-design-review.md
βββ ... (your code)
Usage with custom prompt:
- name: Run Custom AI Analysis
uses: codeaudits/codeaudits-action@v1
with:
style: markdown
llm-custom-prompt: performance-analysis.md # or just: performance-analysis
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}Important notes:
- You cannot use both
llm-promptandllm-custom-promptat the same time - The
.mdextension is optional when specifying the filename - Custom prompt files should contain markdown-formatted prompts for the AI analysis
- name: Run CodeAudits Analysis
uses: codeaudits/codeaudits-action@v1
with:
style: markdown- name: Run AI-Powered Code Analysis
uses: codeaudits/codeaudits-action@v1
with:
style: markdown
compress: true
llm-prompt: architecture-refactoring
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}- name: Run Custom AI Analysis
uses: codeaudits/codeaudits-action@v1
with:
style: markdown
compress: true
llm-custom-prompt: security-review
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}Setting up Gemini API Key:
- Get your API key from Google AI Studio
- Add it as a repository secret named
GEMINI_API_KEY - The AI analysis results will appear in the GitHub Actions job summary
You can find complete workflow examples in the .github/workflows directory:
- llm_audit.yml - Complete workflow with AI-powered audit using predefined prompts
- llm_audit_custom_prompt.yml - AI audit using custom prompts from your repository
- llm_audit_external_codebase.yml - Audit external repositories with AI analysis
- llm_parse_only.yml - Parse repository without AI analysis (output only)
- llm_parse_only_external_codebase.yml - Parse external repositories without AI analysis
These examples demonstrate different use cases and can be copied directly to your repository's .github/workflows directory.
After the action completes:
- The parsed repository will be available as a GitHub Actions artifact named
parsed-repo.txt - Detailed metadata about the parsing process will be available in the job outputs
This project is licensed under the MIT License - see the LICENSE file for details.