Force COMMENT for PR review when reviewer is the PR author#15838
Merged
pelikhan merged 1 commit intogithub:mainfrom Feb 15, 2026
Merged
Force COMMENT for PR review when reviewer is the PR author#15838pelikhan merged 1 commit intogithub:mainfrom
pelikhan merged 1 commit intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements a safeguard to prevent API errors when a reviewer attempts to approve or request changes on their own pull request. GitHub's API only allows COMMENT reviews on your own PRs, so this change automatically downgrades APPROVE or REQUEST_CHANGES events to COMMENT when the authenticated user is also the PR author.
Changes:
- Added author check in
submitReview()that compares authenticated user with PR author before submitting - Automatically downgrades non-
COMMENTreview events toCOMMENTwhen reviewer equals PR author - Added 6 comprehensive test cases covering all scenarios including edge cases and error handling
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| actions/setup/js/pr_review_buffer.cjs | Implements author detection logic using github.rest.users.getAuthenticated() with graceful error handling and optional chaining |
| actions/setup/js/pr_review_buffer.test.cjs | Adds comprehensive test coverage for author check including happy path, edge cases (missing user info), and error scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Feb 15, 2026
pelikhan
approved these changes
Feb 15, 2026
This was referenced Feb 15, 2026
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.
Fixes #15837
APPROVEorREQUEST_CHANGEStoCOMMENT