exempt an approval requirement for automated account #167357
Replies: 9 comments 2 replies
|
How to Let Your GitHub Bot Merge Pull Requests Without Needing Approval If your bot is trying to merge pull requests (PRs) but keeps getting blocked because of review rules, here’s how to fix it. Step-by-Step Guide Go to Repository Settings Open your repository on GitHub Click on “Settings” at the top Then go to “Branches” Under “Branch protection rules,” find the one for your main branch (like main or master), and click “Edit” Change the Bypass Settings Check "Allow specified actors to bypass required pull requests" Check "Restrict who can dismiss pull request reviews" Add Your Bot’s Name After you check the boxes, a new input field will appear Type in your bot’s GitHub username (this is case-sensitive) Select your bot from the list that appears Click "Save changes" Important Things to Know
If It Still Doesn’t Work Try these steps: Give your bot temporary admin access to the repo Check if the pull request is coming from a fork (bypass rules don’t work on fork PRs) If it’s a GitHub App, write the bot name like this: Example If your bot is called cool-bot, the rule should look like this: Restrict who can dismiss pull request reviews: |
|
Hi @kishor7007, You're on the right track with the branch protection settings, but sometimes even with Here’s a full checklist to make sure your automated account (bot) is truly exempt from PR review requirements: ✅ 1. Double-check "Bypass required pull request reviews"Go to: Repository → Settings → Branches → Edit your protection rule
If it's a GitHub App bot, use the format: Example: ✅ 2. Confirm the PR OriginBypass rules only apply if the pull request:
If the PR comes from a fork or uses a generic token, the bypass rule won't apply. ✅ 3. Confirm Bot Permissions
You can verify this under: 🔧 Bonus: Using GitHub Actions Bot?If your PRs are created by GitHub Actions (
❗ Still Doesn’t Work?
Hope this helps! |
|
Hi @kishor7007, Go to Repository Settings → Branches → select your protected branch rule. Under “Allow specified actors to bypass required pull requests”, ensure: Your bot account is listed. The option “Require approvals” is not enforced on bypassed actors. When your bot opens a PR, it cannot self-merge unless: It is also the one merging the PR and It has admin/bypass rights to the branch. |
|
To exempt your bot from PR approval:
|
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
|
Here’s what’s going on: The setting “Allow specified actors to bypass required pull requests” means those accounts (your bot in this case) can push directly to the protected branch without opening a PR at all. The required reviews rule applies to pull requests regardless of who opened them. There isn’t currently a first-class option to say “only require reviews for human accounts, but not for this bot’s PRs.” Options you have Let the bot push directly Use CODEOWNERS with ! negation Use GitHub Actions / automation to auto-approve Use peter-evans/approve-pull-request Give a GitHub App or a separate bot token the ability to approve. Trigger it on pull_request events where actor == your-bot. Split branch protection rules main → requires 1 approval. bot/* → no approvals required (and your automation PRs target those first, then merge/fast-forward to main). 👉 The key takeaway: Do you want your bot’s changes to still go through PRs for visibility, or are you okay with letting it push directly to the branch? That determines the cleanest solution. |
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
|
+1, hitting this too — and can confirm the root cause with a clean test. We have a repository ruleset (require_code_owner_review + required_approving_review_count) with a GitHub App added as a bypass_actors entry (Integration type, tried both bypass_mode: always and pull_request). The app auto-approves and calls |
|
Follow-up with concrete repro data, in case it helps someone on the GitHub side pick this up — this is fully reproducible on our end: Setup: Repository ruleset, Test A — PR with all checks green, approved by the bypass-listed App, auto-merge enabled via Test B — same PR conditions, but instead of No special override flag, no admin privileges beyond being a listed bypass actor. Result: merged instantly, no error. So the bypass grant itself is real and correctly enforced by the synchronous merge endpoint — it's specifically the async/deferred auto-merge completion path that never re-checks Workaround for anyone stuck on this: have your automation call the merge endpoint directly (Test B) instead of relying on |
Uh oh!
There was an error while loading. Please reload this page.
Select Topic Area
Question
Body
I want to exempt an approval requirement for automated account,
I have a branch protection rules setup with approval required count : 1 for user's PRs to review.
However, I have a bot account for automated work, those PRs are not required approval. How can I exempt it?
Restrict who can dismiss pull request reviews enabled and included my bot account.
Allow specified actors to bypass required pull requests enabled and included my bot account.
still it the bot created PR asking for approval. can someone help me on this?
All reactions