Skip to content
Merged
Show file tree
Hide file tree
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
70 changes: 0 additions & 70 deletions .gemini/ci/pr-review/PROMPT.md

This file was deleted.

32 changes: 32 additions & 0 deletions .gemini/commands/pr-code-review.toml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
description = "Reviews the code changes in your pull request"
prompt = """
<CONTEXT>
**GitHub Repository**: ${REPOSITORY}
**Pull Request Number**: ${PULL_REQUEST_NUMBER}
**Additional User Instructions**: ${ADDITIONAL_CONTEXT}
**Pull Review Details**: use `pull_request_read.get` tool to get the title, body, and metadata about the pull request.
**Code Changes**: call the `pull_request_read.get_diff` tool to retrieve the changes.
</CONTEXT>

<PROTOCOL>
The `code-review-commons` skill is ALREADY loaded and active. Proceed directly to analyzing the diffs using the `github` MCP tools.
</PROTOCOL>

# Pull Request Review Guidelines

You are performing an automated Pull Request review for this repository.
To ensure high-quality, clean, and non-spammy feedback, you MUST strictly adhere to the following rules:

## 1. Environment & Context
- The target repository name is provided in the `REPOSITORY` environment variable.
- The Pull Request number is provided in the `PULL_REQUEST_NUMBER` environment variable.
- When calling any GitHub MCP tools (such as `pull_request_read.get`, `pull_request_read.get_diff`, `create_pending_pull_request_review`, `add_comment_to_pending_review`, or `submit_pending_pull_request_review`), you MUST use these exact literal values:
- `repository`: "${REPOSITORY}"
- `pull_request_number`: ${PULL_REQUEST_NUMBER} (as a literal numeric integer. You MUST pass it as a number, do NOT wrap it in quotes!)
- **CRITICAL:** Do NOT use placeholder variables, string templates (like `"$REPOSITORY"` or `"$PULL_REQUEST_NUMBER"`), or environment variable references inside your Python tool call arguments. You MUST resolve and pass the literal values directly.

## 2. Anti-Spam Guardrail
- **CRITICAL:** First, fetch and read the Pull Request's existing review comments using `pull_request_read`.
- If an issue at a specific file and line has already been pointed out in a previous review comment, **do NOT post a duplicate comment**.
- You must suppress duplicate suggestions to prevent spamming the PR on synchronizing push events. Only post comments for newly introduced changes or unaddressed issues.
"""
16 changes: 9 additions & 7 deletions .github/workflows/gemini-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,18 @@ jobs:
run: |
python3 -c '
import os
content = open("PROMPT.md").read()
content = open("../../commands/pr-code-review.toml.template").read()
content = content.replace("${REPOSITORY}", os.environ["REPOSITORY"])
content = content.replace("${PULL_REQUEST_NUMBER}", os.environ["PULL_REQUEST_NUMBER"])
content = content.replace("${ADDITIONAL_CONTEXT}", os.environ.get("ADDITIONAL_CONTEXT", ""))
open("PROMPT_RESOLVED.md", "w").write(content)
add_ctx = os.environ.get("ADDITIONAL_CONTEXT", "").strip()
if not add_ctx:
add_ctx = "None"
content = content.replace("${ADDITIONAL_CONTEXT}", add_ctx)
open("../../commands/pr-code-review.toml", "w").write(content)
'

echo "=== DEBUG: PROMPT_RESOLVED.md ==="
cat PROMPT_RESOLVED.md
echo "=== DEBUG: pr-code-review.toml ==="
cat ../../commands/pr-code-review.toml
echo "=================================="

{
Expand All @@ -59,8 +62,7 @@ jobs:
echo "EOF"

echo "prompt<<EOF"
cat PROMPT_RESOLVED.md
echo ""
echo "/pr-code-review"
echo "EOF"

echo "extensions<<EOF"
Expand Down
10 changes: 10 additions & 0 deletions another_bad_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sqlite3

def get_user_data(username):
conn = sqlite3.connect('users.db')
cursor = conn.cursor()
query = f"SELECT * FROM users WHERE username = '{username}'"
cursor.execute(query)
return cursor.fetchall()

unused_var = 10
Loading