Skip to content

Commit c1a873f

Browse files
PR Review Prompt Changes (#75)
### Description Update `.github/workflows/gemini-pr-review.yml` to try and make the prompt yield a more consistent result with a comments that are inline, prefer suggestions, have individual priorities, and a more concise summary. ### Changes - Remove references to the `write_file` tool, since it is no longer needed for posting the review - Combine the comment syntaxes for `prioritization` and for `content` to a unified syntax - Move `Review Areas` above the detailed approach describing tool use - Indention changes for consistency - Include the `summary` section with the other instructions, since the `summary` comment is made with the `mcp__github__submit_pending_pull_request_review` tool call - Copy changes to `workflows/pr-review/gemini-pr-review.yml` ### Testing Invoked the action multiple times. Example pr review: <img width="918" height="987" alt="image" src="https://github.com/user-attachments/assets/f215622e-b50e-4bc1-9551-5546dd6cfa06" /> --------- Signed-off-by: Lee James <40045512+leehagoodjames@users.noreply.github.com> Co-authored-by: Jerop Kipruto <jerop@google.com>
1 parent db019b7 commit c1a873f

2 files changed

Lines changed: 98 additions & 108 deletions

File tree

.github/workflows/gemini-pr-review.yml

Lines changed: 49 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ jobs:
191191
"run_shell_command(cat)",
192192
"run_shell_command(head)",
193193
"run_shell_command(tail)",
194-
"run_shell_command(grep)",
195-
"write_file"
194+
"run_shell_command(grep)"
196195
],
197196
"telemetry": {
198197
"enabled": true,
@@ -234,33 +233,6 @@ jobs:
234233
235234
## Review
236235
237-
Once you have the information, provide a comprehensive code review by:
238-
1. Writing your review to a file: write_file("review.md", "<your
239-
detailed review feedback here>")
240-
241-
2. Posting the review:
242-
2.1 Use the mcp__github__create_pending_pull_request_review to create a Pending Pull Request Review.
243-
244-
2.2 Use the mcp__github__add_comment_to_pending_review to add comments to the Pending Pull Request Review. Inline comments are preffered whenever possible, so repeat this step, calling mcp__github__add_comment_to_pending_review, as needed. All comments about specific lines of code should use inline comments. It is preferred to use code suggestions when possible, which include a code block that is labeled "suggestion", which contains what the new code should be. An example is:
245-
{{COMMENT_TEXT}}
246-
```suggestion
247-
{{CODE_SUGGESTION}}
248-
```
249-
Prepend a priority emoji to each comment:
250-
- 🟢 for low priority
251-
- 🟡 for medium priority
252-
- 🟠 for high priority
253-
- 🔴 for critical priority
254-
- 🔵 if priority is unclear
255-
256-
Example:
257-
```
258-
🟠
259-
This is a high priority issue.
260-
```
261-
262-
2.3 Use the mcp__github__submit_pending_pull_request_review to submit the Pending Pull Request Review.
263-
264236
Review Areas:
265237
- **Security**: Authentication, authorization, input validation,
266238
data sanitization
@@ -272,37 +244,60 @@ jobs:
272244
conventions
273245
- **Functionality**: Logic correctness, requirements fulfillment
274246
275-
## Output
276-
277-
Structure your review using this exact format with markdown:
278-
'''
279-
## 📋 Review Summary
280-
281-
Provide a brief 2-3 sentence overview of the PR and overall
282-
assessment.
283-
284-
## 🔍 General Feedback
285-
- List general observations about code quality
286-
- Mention overall patterns or architectural decisions
287-
- Highlight positive aspects of the implementation
288-
- Note any recurring themes across files
247+
Once you have the information, provide a comprehensive code review by:
248+
1. Creating a pending review: Use the mcp__github__create_pending_pull_request_review to create a Pending Pull Request Review.
249+
250+
2. Adding review comments:
251+
2.1 Use the mcp__github__add_comment_to_pending_review to add comments to the Pending Pull Request Review. Inline comments are preffered whenever possible, so repeat this step, calling mcp__github__add_comment_to_pending_review, as needed. All comments about specific lines of code should use inline comments. It is preferred to use code suggestions when possible, which include a code block that is labeled "suggestion", which contains what the new code should be. All comments should also have a piority. They syntax is:
252+
Normal Comment Syntax:
253+
<COMMENT>
254+
{{PRIORITY}} {{COMMENT_TEXT}}
255+
</COMMENT>
256+
257+
Inline Comment Syntax: (Preferred):
258+
<COMMENT>
259+
{{PRIORITY}} {{COMMENT_TEXT}}
260+
```suggestion
261+
{{CODE_SUGGESTION}}
262+
```
263+
</COMMENT>
264+
265+
Prepend a priority emoji to each comment:
266+
- 🟢 for low priority
267+
- 🟡 for medium priority
268+
- 🟠 for high priority
269+
- 🔴 for critical priority
270+
- 🔵 if priority is unclear
271+
272+
Including all of this, an example inline comment would be:
273+
<COMMENT>
274+
🟢 Use camelCase for function names
275+
```suggestion
276+
myFooBarFunction
277+
```
278+
</COMMENT>
289279
290-
## ✅ Highlights
280+
A critical priority example would be:
281+
<COMMENT>
282+
🔴 Remove storage key from GitHub
283+
```suggestion
284+
```
291285
292-
(Only include this section if there are positive aspects to
293-
highlight)
286+
3. Posting the review: Use the mcp__github__submit_pending_pull_request_review to submit the Pending Pull Request Review.
294287
295-
- Mention specific good practices or implementations
296-
- Acknowledge well-written code sections
297-
- Note improvements from previous versions
288+
3.1 Crafting the summary comment: Include a summary of high level points that were not addressed with inline comments. Be concise. Do not repeat details mentioned inline.
298289
299-
## ❓ Questions
290+
Structure your summary comment using this exact format with markdown:
291+
## 📋 Review Summary
300292
301-
(Only include this section if there are questions)
293+
Provide a brief 2-3 sentence overview of the PR and overall
294+
assessment.
302295
303-
- List any questions you have about the implementation
304-
- Clarifications needed from the author
305-
'''
296+
## 🔍 General Feedback
297+
- List general observations about code quality
298+
- Mention overall patterns or architectural decisions
299+
- Highlight positive aspects of the implementation
300+
- Note any recurring themes across files
306301
307302
- name: 'Post PR review failure comment'
308303
if: |-

workflows/pr-review/gemini-pr-review.yml

Lines changed: 49 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ jobs:
191191
"run_shell_command(cat)",
192192
"run_shell_command(head)",
193193
"run_shell_command(tail)",
194-
"run_shell_command(grep)",
195-
"write_file"
194+
"run_shell_command(grep)"
196195
],
197196
"telemetry": {
198197
"enabled": true,
@@ -234,33 +233,6 @@ jobs:
234233
235234
## Review
236235
237-
Once you have the information, provide a comprehensive code review by:
238-
1. Writing your review to a file: write_file("review.md", "<your
239-
detailed review feedback here>")
240-
241-
2. Posting the review:
242-
2.1 Use the mcp__github__create_pending_pull_request_review to create a Pending Pull Request Review.
243-
244-
2.2 Use the mcp__github__add_comment_to_pending_review to add comments to the Pending Pull Request Review. Inline comments are preffered whenever possible, so repeat this step, calling mcp__github__add_comment_to_pending_review, as needed. All comments about specific lines of code should use inline comments. It is preferred to use code suggestions when possible, which include a code block that is labeled "suggestion", which contains what the new code should be. An example is:
245-
{{COMMENT_TEXT}}
246-
```suggestion
247-
{{CODE_SUGGESTION}}
248-
```
249-
Prepend a priority emoji to each comment:
250-
- 🟢 for low priority
251-
- 🟡 for medium priority
252-
- 🟠 for high priority
253-
- 🔴 for critical priority
254-
- 🔵 if priority is unclear
255-
256-
Example:
257-
```
258-
🟠
259-
This is a high priority issue.
260-
```
261-
262-
2.3 Use the mcp__github__submit_pending_pull_request_review to submit the Pending Pull Request Review.
263-
264236
Review Areas:
265237
- **Security**: Authentication, authorization, input validation,
266238
data sanitization
@@ -272,37 +244,60 @@ jobs:
272244
conventions
273245
- **Functionality**: Logic correctness, requirements fulfillment
274246
275-
## Output
276-
277-
Structure your review using this exact format with markdown:
278-
'''
279-
## 📋 Review Summary
280-
281-
Provide a brief 2-3 sentence overview of the PR and overall
282-
assessment.
283-
284-
## 🔍 General Feedback
285-
- List general observations about code quality
286-
- Mention overall patterns or architectural decisions
287-
- Highlight positive aspects of the implementation
288-
- Note any recurring themes across files
247+
Once you have the information, provide a comprehensive code review by:
248+
1. Creating a pending review: Use the mcp__github__create_pending_pull_request_review to create a Pending Pull Request Review.
249+
250+
2. Adding review comments:
251+
2.1 Use the mcp__github__add_comment_to_pending_review to add comments to the Pending Pull Request Review. Inline comments are preffered whenever possible, so repeat this step, calling mcp__github__add_comment_to_pending_review, as needed. All comments about specific lines of code should use inline comments. It is preferred to use code suggestions when possible, which include a code block that is labeled "suggestion", which contains what the new code should be. All comments should also have a piority. They syntax is:
252+
Normal Comment Syntax:
253+
<COMMENT>
254+
{{PRIORITY}} {{COMMENT_TEXT}}
255+
</COMMENT>
256+
257+
Inline Comment Syntax: (Preffered):
258+
<COMMENT>
259+
{{PRIORITY}} {{COMMENT_TEXT}}
260+
```suggestion
261+
{{CODE_SUGGESTION}}
262+
```
263+
</COMMENT>
264+
265+
Prepend a priority emoji to each comment:
266+
- 🟢 for low priority
267+
- 🟡 for medium priority
268+
- 🟠 for high priority
269+
- 🔴 for critical priority
270+
- 🔵 if priority is unclear
271+
272+
Including all of this, an example inline comment would be:
273+
<COMMENT>
274+
🟢 Use camelCase for function names
275+
```suggestion
276+
myFooBarFunction
277+
```
278+
</COMMENT>
289279
290-
## ✅ Highlights
280+
A critical priority example would be:
281+
<COMMENT>
282+
🔴 Remove storage key from GitHub
283+
```suggestion
284+
```
291285
292-
(Only include this section if there are positive aspects to
293-
highlight)
286+
3. Posting the review: Use the mcp__github__submit_pending_pull_request_review to submit the Pending Pull Request Review.
294287
295-
- Mention specific good practices or implementations
296-
- Acknowledge well-written code sections
297-
- Note improvements from previous versions
288+
3.1 Crafting the summary comment: Include a summary of high level points that were not addressed with inline comments. Be concise. Do not repeat details mentioned inline.
298289
299-
## ❓ Questions
290+
Structure your summary comment using this exact format with markdown:
291+
## 📋 Review Summary
300292
301-
(Only include this section if there are questions)
293+
Provide a brief 2-3 sentence overview of the PR and overall
294+
assessment.
302295
303-
- List any questions you have about the implementation
304-
- Clarifications needed from the author
305-
'''
296+
## 🔍 General Feedback
297+
- List general observations about code quality
298+
- Mention overall patterns or architectural decisions
299+
- Highlight positive aspects of the implementation
300+
- Note any recurring themes across files
306301
307302
- name: 'Post PR review failure comment'
308303
if: |-

0 commit comments

Comments
 (0)