https://github.com/elementsinteractive/lgtm-ai-action
GitHub Action to run lgtm-ai (https://github.com/elementsinteractive/lgtm-ai)
https://github.com/elementsinteractive/lgtm-ai-action
actions ai code-review dev-tools
Last synced: 6 months ago
JSON representation
GitHub Action to run lgtm-ai (https://github.com/elementsinteractive/lgtm-ai)
- Host: GitHub
- URL: https://github.com/elementsinteractive/lgtm-ai-action
- Owner: elementsinteractive
- License: mit
- Created: 2025-08-13T08:17:03.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-09-29T07:09:17.000Z (6 months ago)
- Last Synced: 2025-09-29T09:10:08.918Z (6 months ago)
- Topics: actions, ai, code-review, dev-tools
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# lgtm-ai-action
GitHub Action to run [lgtm-ai](https://github.com/elementsinteractive/lgtm-ai).
This action can be used to perform automatic code-reviews or write reviewer guides using LLMs, thanks to lgtm-ai.
## Usage
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `ai-api-key` | API key for AI service (OpenAI, Anthropic, Google, etc.) | ✅ | - |
| `git-api-key` | API key for GitHub (you can use GITHUB_TOKEN) | ✅ | - |
| `pr-number` | Pull request number to review | ✅ | - |
| `model` | AI model to use (e.g. gpt-4o, claude-3-5-sonnet-latest, gemini-2.0-flash) | ❌ | *Uses config file or tool default* |
| `version` | LGTM AI version (latest, v0.7.2, etc.) | ❌ | `latest` |
| `publish` | Whether to publish the review as PR comments | ❌ | `true` |
| `exclude` | File patterns to exclude (e.g. '*.md *.json package-lock.json') | ❌ | `""` (none) |
| `config` | Path to lgtm.toml configuration file (e.g. '.lgtm.toml') | ❌ | `""` (none) |
| `output-format` | Output format for the review (pretty, json, markdown) | ❌ | `pretty` |
| `issues-platform` | Platform of the issues/user stories (github, gitlab, jira) | ❌ | `""` (none) |
| `issues-url` | Base URL of the issues/user stories | ❌ | `""` (none) |
| `issues-api-key` | API Key to connect to the issues platform. Can be ommited even if issues integration is set, then `git-api-key` will be used | ❌ | `""` (none) |
| `verbose` | Enable extra verbose output (-vv instead of -v) | ❌ | `false` |
### Quick Usage
```yaml
- name: AI Code Review
uses: elementsinteractive/lgtm-ai-action@v1
with:
ai-api-key: ${{ secrets.AI_API_KEY }}
git-api-key: ${{ secrets.GITHUB_TOKEN }}
model: 'gpt-5'
pr-number: ${{ github.event.issue.number }}
```
### Full Workflow Example
This simple workflow will perform a review whenever someone comments `/lgtm review` in a pull request.
```yaml
name: LGTM Review
on:
issue_comment:
types: [created]
jobs:
lgtm-review:
if: |
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/lgtm review')
runs-on: ubuntu-latest
steps:
- name: Checkout PR code
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.issue.number }}/merge
- name: Run LGTM Review
uses: elementsinteractive/lgtm-ai-action@v1
with:
ai-api-key: ${{ secrets.AI_API_KEY }}
git-api-key: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ github.event.issue.number }}
model: 'gpt-5'
```
> [!TIP]
> The action will autodiscover any `lgtm.toml` file in your repository so you can
> fully configure `lgtm-ai`. For that, you will need to use the `actions/checkout` action in your workflow. See the [configuration documentation](https://github.com/elementsinteractive/lgtm-ai?tab=readme-ov-file#configuration) for more information about how to configure `lgtm-ai`.