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

A regulator asks who changed branch protection settings and when.

AdvancedScenarioProtection, Hooks and Policy
Answer

Situation read → You need an audit trail outside Git.

What I'd do →

  1. Query the organisation audit log (UI, or gh api /orgs/ORG/audit-log on Enterprise Cloud) filtering for ruleset and protection events.
  2. Stream audit logs to your SIEM for long-term retention.
  3. Store protection config as code (Terraform github_repository_ruleset) so changes are PR-reviewed.
  4. Alert on bypass events and ruleset edits.

Why → Config as code gives history, review and rollback for the controls themselves.

Interview tip → Say "protect the protections" — admins who can change rules can undo any control.

All Git & GitHub questions Roadmap: Git & GitHub

More on Protection, Hooks and Policy