What You’ll Connect
After this guide, your GitHub Actions workflows will call a self-hosted AI model on your own GPU server — no API costs, no rate limits. Every pull request triggers an AI code review, and commit messages get automatic summarisation, all powered by a model running on dedicated GPU hardware.
The integration adds a workflow step that sends code diffs to your vLLM or Ollama endpoint and posts the AI’s analysis as a PR comment. This brings AI coding assistant capabilities directly into your development workflow without relying on third-party code analysis services.
Actions Workflow –> curl/Script Step –> GPU Server (vLLM) (pull_request) triggered on PR sends diff as LLM inference open/synchronize prompt payload on dedicated GPU | | PR Comment <-- gh CLI posts <-- Script parses <-- AI review text with AI review review comment JSON response returned -->Prerequisites
- A GigaGPU server with a code-capable LLM behind an OpenAI-compatible API (vLLM production guide)
- A GitHub repository where you have permission to add workflows
- HTTPS access to your GPU server from GitHub’s hosted runners (Nginx proxy guide)
- GPU API key stored as a GitHub Actions secret (security guide)
Integration Steps
Add your GPU server API key as a repository secret: Settings > Secrets and variables > Actions > New repository secret, named GPU_API_KEY. Also store your GPU server URL as GPU_API_URL.
Create a workflow file at .github/workflows/ai-review.yml. Configure it to trigger on pull_request events (types: opened, synchronize). The workflow checks out the code, generates a diff, sends it to your GPU inference endpoint, and posts the review as a PR comment using the GitHub CLI.
The diff is truncated to fit within your model’s context window. For large PRs, focus the AI review on changed files matching specific patterns (e.g., *.py, *.ts) to keep the prompt manageable.
Code Example
This GitHub Actions workflow calls your GPU-hosted model to review PR diffs:
# .github/workflows/ai-review.yml
name: AI Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate diff
run: |
git diff origin/${{ github.base_ref }}...HEAD -- '*.py' '*.ts' '*.js' > diff.txt
head -c 12000 diff.txt > trimmed_diff.txt
- name: AI Review
env:
GPU_API_KEY: ${{ secrets.GPU_API_KEY }}
GPU_API_URL: ${{ secrets.GPU_API_URL }}
run: |
DIFF=$(cat trimmed_diff.txt)
RESPONSE=$(curl -s "$GPU_API_URL/v1/chat/completions" \
-H "Authorization: Bearer $GPU_API_KEY" \
-H "Content-Type: application/json" \
-d "$(jq -n --arg diff "$DIFF" '{
model: "deepseek-ai/DeepSeek-Coder-V2-Instruct",
messages: [
{role: "system", content: "Review this code diff. Flag bugs, security issues, and suggest improvements. Be concise."},
{role: "user", content: $diff}
],
max_tokens: 1000
}')")
REVIEW=$(echo "$RESPONSE" | jq -r '.choices[0].message.content')
echo "$REVIEW" > review.txt
- name: Post comment
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr comment ${{ github.event.pull_request.number }} \
--body "## AI Code Review\n\n$(cat review.txt)"
Testing Your Integration
Open a pull request with a small code change. The workflow should trigger within seconds, and after inference completes, an AI review comment appears on the PR. Verify the review content is relevant to the actual changes — not generic boilerplate.
Test with PRs of varying sizes. Confirm that large diffs are properly truncated and the model still produces useful feedback on the visible portion. Check the Actions tab for workflow run timing to gauge end-to-end latency.
Production Tips
GitHub-hosted runners connect to your GPU server over the public internet. Ensure your API authentication is robust and consider IP allowlisting if your GPU provider supports it. For private repositories with sensitive code, use self-hosted GitHub runners within the same network as your GPU server.
Avoid running AI reviews on draft PRs or PRs from bots to save GPU cycles. Add workflow conditions that skip the review for specific authors or labels. Cache reviews by commit SHA to prevent duplicate processing on force-pushes.
For development teams building AI-assisted coding workflows with open-source models, GPU-powered CI reviews provide consistent code quality feedback without per-token costs. Browse more tutorials or get started with GigaGPU to add AI reviews to your pipeline.