ChatGPT-CodeReview
ChatGPT-CodeReview copied to clipboard
Support GitHub Models inference provider
GitHub Models provides free AI inference in GitHub Models (supports all OpenAI models, DeepSeek, plus others). It would be nice to support that in the GitHub Actions version of this project, so users don't need to generate an OpenAI key.
Here's an example (uses built-in GITHUB_TOKEN):
name: Code Review
permissions:
contents: read
pull-requests: write
models: read # Required to call GitHub Models
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
# Required for the action itself to access the PR
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Use GitHub Models for inference
OPENAI_API_KEY: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_ENDPOINT: https://models.github.ai/inference
MODEL: gpt-4o-mini
# Optional tuning
LANGUAGE: English
PROMPT: # example: Please check if there are any confusions or irregularities in the following code diff:
top_p: 1
temperature: 1
max_tokens: 10000
MAX_PATCH_LENGTH: 10000
IGNORE_PATTERNS: /node_modules/**/*,*.md
INCLUDE_PATTERNS: *.js,*.ts
Makes sense. Will look into this feature implement later
added the github models support, here is an exmaple how to use it
- add
models: readto permissions - set
USE_GITHUB_MODELS: trueto enable github models
name: Code Review
permissions:
contents: read
pull-requests: write
models: read
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LANGUAGE: English
USE_GITHUB_MODELS: true
LOG_LEVEL: debug
INCLUDE_PATTERNS: src/*,.github/**/*