Interview Prep/Git & GitHub/Protection, Hooks and Policy

A release bot must push version bump commits to protected `main`, but humans must not.

AdvancedScenarioProtection, Hooks and Policy
Answer

Situation read → The bot needs a narrow exception, not a weakening of the rule for everyone.

What I'd do →

  1. Use a GitHub App (not a personal token) for the bot, with minimal permissions.
  2. Add only that app to the ruleset bypass list.
  3. Prefer having the bot open a PR with auto-merge, which needs no bypass at all.
  4. Store the app credentials as environment secrets and rotate keys.

Why → Apps have scoped permissions and appear clearly in the audit log, unlike a shared human PAT.

Interview tip → The PR-based approach avoids bypass entirely and is the safer pattern.

All Git & GitHub questions Roadmap: Git & GitHub

More on Protection, Hooks and Policy