| .. | ||
| defaults | ||
| tasks | ||
| vars | ||
| README.md | ||
GitHub Organization Governance Role
This role manages GitHub Organization Rulesets to enforce branch protection and governance across all repositories within an organization.
Governance Rules
1. Global Main Protection
- Target:
mainbranch - Inclusion: All repositories (
~ALL) - Rules:
- Prevent deletion.
- Prevent force pushes (non-fast-forward).
- Require at least 1 approving review.
- Dismiss stale reviews on push.
2. Global Release Protection
- Target:
release/*branches - Inclusion: All repositories (
~ALL) - Rules:
- Prevent deletion.
- Prevent force pushes.
- Enforce Linear History: Only Cherry-pick or Rebase merges allowed.
- Require at least 1 approving review.
Requirements
- GitHub CLI (gh) installed on the controller.
- A
GITHUB_TOKENwithadmin:orgpermissions.
Usage
Set your token and run the playbook:
export GITHUB_TOKEN=your_admin_token
ansible-playbook apply-branch-protection.yml
Configuration
github_org_name: Defined indefaults/main.yml.github_rulesets: Defined invars/main.yml.