Skip to content

Force COMMENT for PR review when reviewer is the PR author#15838

Merged
pelikhan merged 1 commit intogithub:mainfrom
strawgate:fix/force-comment-on-self-review
Feb 15, 2026
Merged

Force COMMENT for PR review when reviewer is the PR author#15838
pelikhan merged 1 commit intogithub:mainfrom
strawgate:fix/force-comment-on-self-review

Conversation

@strawgate
Copy link
Contributor

@strawgate strawgate commented Feb 15, 2026

Fixes #15837

  • Detects when the authenticated user submitting a PR review is also the PR author and automatically downgrades APPROVE or REQUEST_CHANGES to COMMENT
  • GitHub API rejects non-COMMENT reviews on your own PRs, so this prevents a failed API call and preserves the review content

Copilot AI review requested due to automatic review settings February 15, 2026 02:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-COMMENT review events to COMMENT when 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.

@strawgate strawgate changed the title Force COMMENT for PR review when reviewer is the PR author (#15837) Force COMMENT for PR review when reviewer is the PR author Feb 15, 2026
@pelikhan pelikhan merged commit d96dccf into github:main Feb 15, 2026
200 of 201 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Force comment for PR Review if the reviewer is also the author

2 participants

Comments