Prevent duplicate Copilot review comments on sequential reviews and reply interactions - #11
Closed
halotukozak with Copilot wants to merge 3 commits into
Closed
Prevent duplicate Copilot review comments on sequential reviews and reply interactions#11halotukozak with Copilot wants to merge 3 commits into
halotukozak with Copilot wants to merge 3 commits into
Conversation
Co-authored-by: halotukozak <64359735+halotukozak@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix duplicate comments in sequential reviews
Avoid duplicate Copilot review comments on sequential PR updates
Mar 18, 2026
Co-authored-by: halotukozak <64359735+halotukozak@users.noreply.github.com>
Copilot
AI
changed the title
Avoid duplicate Copilot review comments on sequential PR updates
Prevent duplicate Copilot review comments on sequential reviews and reply interactions
Mar 18, 2026
halotukozak
marked this pull request as ready for review
March 18, 2026 11:27
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions workflow to prevent Copilot PR review comment duplication across new commits and comment-reply-triggered re-reviews by cleaning up prior Copilot-authored review comments and (on PR open/sync) re-requesting a fresh Copilot review.
Changes:
- Introduces
.github/workflows/copilot-review.ymltriggered onpull_requestandpull_request_review_commentevents. - Deletes existing Copilot-authored PR review comments (allowlisted bot logins) via paginated API calls before a new review cycle.
- Adds an infinite-loop guard to skip runs when the triggering actor is a Copilot bot.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| copilot-review: | ||
| # Skip draft PRs; skip when Copilot itself triggers the event to prevent infinite loops | ||
| if: | | ||
| github.event.pull_request.draft == false && |
| if: | | ||
| github.event.pull_request.draft == false && | ||
| !contains(fromJSON('["github-copilot[bot]","copilot-pull-request-reviewer[bot]"]'), github.actor) | ||
| runs-on: ubuntu-latest |
Comment on lines
+9
to
+12
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copilot duplicates review comments both when new commits are pushed and when users reply to its existing comments, causing comment accumulation across review cycles.
Changes
New workflow (
.github/workflows/copilot-review.yml) with two triggers:pull_request(opened,synchronize,reopened) — cleans up stale Copilot comments, then re-requests a fresh reviewpull_request_review_comment(created) — cleans up stale Copilot comments before Copilot auto-re-reviews in response to a reply; skips re-requesting review since Copilot handles that itselfInfinite-loop guard — job is skipped when
github.actoris a known Copilot bot login (github-copilot[bot],copilot-pull-request-reviewer[bot]), preventing Copilot's own comment events from re-triggering the workflowScoped cleanup — only deletes review comments authored by known Copilot bot logins (exact allowlist, not substring match) via paginated
listReviewComments+deleteReviewCommentSafe PR-number resolution —
context.payload.pull_request?.number ?? context.issue.numberhandles both event payload shapes💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.