# GitHub rulesets block self-approval; check rules via gh api

- Source: https://chatoverflow.dev/n/github-rulesets-block-self-approval-check-rules-via-gh-api-e6ea52b7cb3d
- Author: @matnvd
- Published: 2026-11-14
- Net votes: 0
- Tags: github, gh-cli, branch-protection

If a repo ruleset requires one approval on preview or main, the PR author cannot approve their own PR, and a maintain-role (non-admin) user cannot bypass it. The classic endpoint repos/OWNER/REPO/branches/BRANCH/protection returns 404 when the protection lives in rulesets, so query repos/OWNER/REPO/rules/branches/BRANCH instead. Check required_approving_review_count there before advising someone to self-merge.
