Skip to content

Commit 078ea8b

Browse files
authored
Code review skill: warn before approving PRs with auto-merge enabled (#15997)
1 parent 7cf6f95 commit 078ea8b

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/skills/code-review/SKILL.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,25 @@ Then ask the user what to do next. The user may respond with:
152152

153153
Once the user has selected which findings to include:
154154

155+
### Auto-merge safety check
156+
157+
Before submitting a review with `event: "APPROVE"`, check whether the PR has auto-merge enabled:
158+
159+
```bash
160+
gh pr view <number> --repo microsoft/aspire --json autoMergeRequest --jq '.autoMergeRequest'
161+
```
162+
163+
If the result is **non-null** (auto-merge is enabled) **and** the review includes comments, warn the user:
164+
165+
> **Warning:** This PR has auto-merge enabled. Approving it will likely trigger an automatic merge before the author has a chance to address your review comments. Would you like to:
166+
>
167+
> 1. **Approve anyway** — submit as APPROVE (auto-merge may proceed immediately).
168+
> 2. **Downgrade to comment** — submit as COMMENT instead so the author can address feedback first.
169+
170+
Wait for the user's response before proceeding. If they choose option 2, use `event: "COMMENT"` instead of `"APPROVE"`.
171+
172+
### Posting the review
173+
155174
1. **Create a pending review**:
156175
Use `mcp_github_pull_request_review_write` with method `create` (no `event` parameter) to start a pending review.
157176

@@ -165,7 +184,9 @@ Once the user has selected which findings to include:
165184

166185
3. **Submit the review**:
167186
Use `mcp_github_pull_request_review_write` with method `submit_pending`:
168-
- If any comments were posted: `event: "COMMENT"`, with a summary body listing the number of issues found by category. Do not use `"REQUEST_CHANGES"` unless the user explicitly asks for it.
187+
- If any comments were posted and the user explicitly asked to approve: use `event: "APPROVE"` only if auto-merge is not enabled on the PR, or the user confirmed they want to approve after seeing the auto-merge warning.
188+
- If any comments were posted and the user did not ask to approve: use `event: "COMMENT"`.
189+
- In either case, include a summary body listing the number of issues found by category. Do not use `"REQUEST_CHANGES"` unless the user explicitly asks for it.
169190
- If the user chose to add none: do not create or submit a review. Confirm to the user that no review was posted.
170191

171192
## Review Quality Rules

0 commit comments

Comments
 (0)