-
Notifications
You must be signed in to change notification settings - Fork 0
docs: add README with setup and configuration guide #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| # codereview | ||
|
|
||
| LLM-powered pull request code review as a GitHub Action. Posts inline review comments using [conventional comments](https://conventionalcomments.org/) format and submits a verdict (approve, request changes, or comment). | ||
|
|
||
| ## Features | ||
|
|
||
| - Reviews PR diffs with full file context | ||
| - Uses conventional comment labels: `nit:`, `suggestion:`, `issue:`, `question:`, `thought:`, `chore:`, `praise:` | ||
| - Replies to comment threads when developers respond | ||
| - Resolves threads automatically when concerns are addressed | ||
| - Remembers prior comments to avoid repeating itself | ||
| - Configurable LLM provider (Gemini supported, more planned) | ||
|
|
||
| ## Quick start | ||
|
|
||
| Add a workflow file to your repository: | ||
|
|
||
| ```yaml | ||
| # .github/workflows/review.yml | ||
| name: Code Review | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| review: | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: LimpidTech/codereview@main | ||
| with: | ||
| gemini-api-key: ${{ secrets.GEMINI_API_KEY }} | ||
| ``` | ||
|
|
||
| Get a Gemini API key from [Google AI Studio](https://aistudio.google.com/apikey) and add it as a repository or organization secret named `GEMINI_API_KEY`. | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Input | Required | Default | Description | | ||
| |-------|----------|---------|-------------| | ||
| | `github-token` | no | `${{ github.token }}` | GitHub token for API access | | ||
| | `provider` | no | `gemini` | LLM provider to use | | ||
| | `gemini-api-key` | no | | API key for Google Gemini | | ||
| | `model` | no | `gemini-2.5-flash` | Model name override | | ||
| | `instructions` | no | | Additional review instructions | | ||
| | `bot-login` | no | `github-actions[bot]` | Bot username for loop prevention | | ||
|
|
||
| ## Providers | ||
|
|
||
| ### Gemini (default) | ||
|
|
||
| ```yaml | ||
| - uses: LimpidTech/codereview@main | ||
| with: | ||
| provider: gemini | ||
| gemini-api-key: ${{ secrets.GEMINI_API_KEY }} | ||
| ``` | ||
|
|
||
| To use a specific model: | ||
|
|
||
| ```yaml | ||
| - uses: LimpidTech/codereview@main | ||
| with: | ||
| gemini-api-key: ${{ secrets.GEMINI_API_KEY }} | ||
| model: gemini-2.5-pro | ||
| ``` | ||
|
|
||
| ### Adding providers | ||
|
|
||
| The codebase is designed for easy provider addition. Each provider implements a single function type: | ||
|
|
||
| ```go | ||
| type ReviewFunc func(ctx context.Context, req Request) (Response, error) | ||
| ``` | ||
|
|
||
| See `internal/provider/gemini/` for a reference implementation. | ||
|
|
||
| ## Custom instructions | ||
|
|
||
| Use the `instructions` input to guide the reviewer toward your project's conventions: | ||
|
|
||
| ```yaml | ||
| - uses: LimpidTech/codereview@main | ||
| with: | ||
| gemini-api-key: ${{ secrets.GEMINI_API_KEY }} | ||
| instructions: | | ||
| This is a Go project using the standard library only. | ||
| We prefer table-driven tests. | ||
| Error messages should not be capitalized. | ||
| All exported functions must have doc comments. | ||
| ``` | ||
|
|
||
| Instructions are prepended to the review prompt, so the LLM will consider them alongside the diff and file context. | ||
|
|
||
| ## How it works | ||
|
|
||
| ### On PR open / push | ||
|
|
||
| 1. Fetches the PR diff and full contents of changed files | ||
| 2. Fetches any prior review comments it has already made | ||
| 3. Sends everything to the configured LLM with review instructions | ||
| 4. Posts inline review comments with conventional labels | ||
| 5. Submits a verdict: `APPROVE`, `REQUEST_CHANGES`, or `COMMENT` | ||
|
|
||
| ### On review comment reply | ||
|
|
||
| 1. Fetches the full conversation thread | ||
| 2. Sends the thread context and relevant diff hunk to the LLM | ||
| 3. Posts a reply | ||
| 4. If the concern is resolved, automatically resolves the thread (only for threads it started) | ||
|
|
||
| ## Permissions | ||
|
|
||
| The workflow needs these permissions: | ||
|
|
||
| ```yaml | ||
| permissions: | ||
| pull-requests: write # post reviews, reply to comments, resolve threads | ||
| contents: read # fetch file contents for context | ||
| ``` | ||
|
|
||
| ## Using with a GitHub App token | ||
|
|
||
| If you use a GitHub App token instead of the default `GITHUB_TOKEN`, set `bot-login` to the app's bot username so it doesn't reply to its own comments: | ||
|
|
||
| ```yaml | ||
| - uses: LimpidTech/codereview@main | ||
| with: | ||
| github-token: ${{ steps.app-token.outputs.token }} | ||
| gemini-api-key: ${{ secrets.GEMINI_API_KEY }} | ||
| bot-login: my-app[bot] | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| BSD 2-Clause. See [LICENSE](LICENSE) for details. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: This is a very thorough and well-organized README. It clearly explains the action's functionality, usage, and underlying mechanisms. Excellent work.