Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ai-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Code Review by Gemini AI"

on:
pull_request:

jobs:
review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: "Get diff of the pull request"
id: get_diff
shell: bash
env:
PULL_REQUEST_HEAD_REF: "${{ github.event.pull_request.head.ref }}"
PULL_REQUEST_BASE_REF: "${{ github.event.pull_request.base.ref }}"
run: |-
git fetch origin "${{ env.PULL_REQUEST_HEAD_REF }}"
git fetch origin "${{ env.PULL_REQUEST_BASE_REF }}"
git checkout "${{ env.PULL_REQUEST_HEAD_REF }}"
git diff "origin/${{ env.PULL_REQUEST_BASE_REF }}" > "diff.txt"
{
echo "pull_request_diff<<EOF";
cat "diff.txt";
echo 'EOF';
} >> $GITHUB_OUTPUT
- uses: ./
name: "Code Review by Gemini AI"
id: review
with:
gemini_api_key: ${{ secrets.GEMINI_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repository: ${{ github.repository }}
github_pull_request_number: ${{ github.event.pull_request.number }}
git_commit_hash: ${{ github.event.pull_request.head.sha }}
model: "gemini-2.5-pro"
pull_request_diff: |-
${{ steps.get_diff.outputs.pull_request_diff }}
pull_request_chunk_size: "3500"
extra_prompt: |-
Validate your answers, always respond in English!
log_level: "DEBUG"
Loading