Skip to content

fix: hide approve button when user is PR author#12

Merged
rrbe merged 2 commits intomainfrom
fix-approve-pr
Apr 17, 2026
Merged

fix: hide approve button when user is PR author#12
rrbe merged 2 commits intomainfrom
fix-approve-pr

Conversation

@rrbe
Copy link
Copy Markdown
Owner

@rrbe rrbe commented Apr 17, 2026

Summary

  • Skip injecting the "approve now" button when the current user is the PR author, since GitHub forbids self-approval and the click would fail with an API error.
  • Detects self-authorship by comparing meta[name="user-login"] against the PR header's author link.

Test plan

  • On a PR you authored: no "approve now" link appears next to the Reviewers heading.
  • On a PR authored by someone else: "approve now" appears and still works.
  • Logged-out or unexpected DOM: button still renders (graceful fallback, no crash).

🤖 Generated with Claude Code

rrbe and others added 2 commits April 17, 2026 16:49
GitHub disallows self-approval, so showing the button on the author's
own PR leads to an API error on click.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The old .gh-header-meta selectors no longer match GitHub's React-based
PR page, so the self-author check silently failed. Try new-UI selectors
first and fall back to the classic one.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rrbe rrbe merged commit 3fa05ab into main Apr 17, 2026
@rrbe rrbe deleted the fix-approve-pr branch April 17, 2026 09:12
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.

1 participant