GitHub Action to review code in a repository using the OpenAI API OpenAI
OPENAI_API_KEY
: OpenAI API key for GPT.OPENAI_ASSISTANT_ID
: OpenAI Assistant ID.exclude
: Glob patterns to exclude files from the diff analysis.language
: Language of the comments.model
: Model to use for the review. Default isgpt-4-turbo
.
countFiles
: Number of files in the diff.countComments
: Number of comments made.commentUrl
: URL to the comment.
on:
pull_request:
types:
- opened
- synchronize
permissions: write-all
jobs:
reviewer:
runs-on: ubuntu-latest
name: AI Action Code Reviewer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: AI Code Reviewer
uses: leguass7/ai-reviewer@main
id: aireviewer
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_ASSISTANT_ID: ${{ secrets.OPENAI_ASSISTANT_ID }}
exclude: '**/*.json, **/*.md, **/*.map, **/*.lock.json, dist/**/*.js'
model: 'gpt-4-turbo'
# Use the output step
- name: Get the output
run: echo "OUTPUT FILES=${{ steps.aireviewer.outputs.countFiles }}"