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
22 changes: 10 additions & 12 deletions .gemini/ci/pr-review/PROMPT.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
<CONTEXT>
**GitHub Repository**: ${REPOSITORY}
**Pull Request Number**: ${PULL_REQUEST_NUMBER}
**Additional User Instructions**: ${ADDITIONAL_CONTEXT}
</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
**GitHub Repository**: ${REPOSITORY}
**Pull Request Number**: ${PULL_REQUEST_NUMBER}
**Additional User Instructions**: ${ADDITIONAL_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.
**GitHub Repository**: $REPOSITORY
**Pull Request Number**: $PULL_REQUEST_NUMBER
**Additional User Instructions**: $ADDITIONAL_CONTEXT
- When calling any GitHub MCP tools, 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 or string templates inside your Python tool call arguments.

## 2. Anti-Spam Guardrail
## 2. Skill Activation
The `code-review-commons` skill is ALREADY loaded and active. Proceed directly to analyzing the diffs using the `github` MCP tools.

## 3. 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.
6 changes: 5 additions & 1 deletion .github/workflows/gemini-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ jobs:
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
RAW_COMMENT: ${{ github.event.comment.body || '' }}
run: |
# Extract additional context from the comment (if any)
# Extract additional context from the comment (if any) after the command
# e.g. '@gemini-cli /review focus on security' -> ADDITIONAL_CONTEXT="focus on security"
ADDITIONAL_CONTEXT="None"
if [[ "$RAW_COMMENT" == *"@gemini-cli /review"* ]]; then
ADDITIONAL_CONTEXT=$(echo "$RAW_COMMENT" | sed 's/^@gemini-cli \/review//' | xargs)
[ -z "$ADDITIONAL_CONTEXT" ] && ADDITIONAL_CONTEXT="None"
fi
export REPOSITORY PULL_REQUEST_NUMBER ADDITIONAL_CONTEXT

{
echo "settings<<EOF_DELIM"
cat settings.json
Expand All @@ -63,6 +65,8 @@ jobs:
echo "EOF_DELIM"

echo "prompt<<EOF_DELIM"
echo "/pr-code-review"
echo ""
envsubst '${REPOSITORY} ${PULL_REQUEST_NUMBER} ${ADDITIONAL_CONTEXT}' < PROMPT.md
echo ""
echo "EOF_DELIM"
Expand Down
Loading