ChatGPT-CodeReview icon indicating copy to clipboard operation
ChatGPT-CodeReview copied to clipboard

Support GitHub Models inference provider

Open sgoedecke opened this issue 5 months ago • 2 comments

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

sgoedecke avatar Jul 29 '25 23:07 sgoedecke

Makes sense. Will look into this feature implement later

anc95 avatar Aug 01 '25 07:08 anc95

added the github models support, here is an exmaple how to use it

  1. add models: read to permissions
  2. set USE_GITHUB_MODELS: true to 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/**/*

anc95 avatar Aug 04 '25 08:08 anc95