What is a SubOrg?
A suborg is an arbitrary collection of repositories belonging to projects, business units, or teams. Suborg settings reside in YAML files in the.github/suborgs/ folder of your admin repository.
Suborgs provide a middle layer between organization-wide defaults and repository-specific settings, perfect for team-specific policies.
File Location
Defining SubOrg Membership
Repositories can belong to a suborg in three ways:1. By Repository Name
Usesuborgrepos to match repositories by name patterns using glob expressions:
.github/suborgs/frontend-team.yml
Glob pattern examples
Glob pattern examples
api-*- Matches all repos starting withapi-*-service- Matches all repos ending with-servicecore-*-service- Matches repos likecore-auth-service,core-api-servicetest- Exact match only- Use
*as a wildcard for any characters
2. By Team Membership
Usesuborgteams to include all repositories that have specific teams as collaborators:
.github/suborgs/backend-team.yml
3. By Custom Properties
Usesuborgproperties to include repositories with specific custom property values:
.github/suborgs/security-critical.yml
Combining Membership Criteria
You can combine multiple criteria in a single suborg configuration:.github/suborgs/platform-team.yml
Overriding Org Settings
Suborg settings override org-level settings but can be overridden by repo-level settings. You can override any setting that’s available at the org level:Complete SubOrg Examples
- Frontend Team
- Backend Team
- Security Critical
- Mobile Team
.github/suborgs/frontend-team.yml
Scoping Settings to Repos
Just like at the org level, you can scope teams, collaborators, and labels to specific repositories within the suborg:.github/suborgs/platform-team.yml
Rulesets in SubOrgs
Suborgs can define rulesets, but they cannot use therepository_name condition (that’s org-level only):
.github/suborgs/backend-team.yml
When a suborg and repo-level ruleset have the same name, their rules are merged. Be careful not to define the same rule type in both levels as GitHub will reject it.
When Changes Are Applied
Suborg settings are applied in the following scenarios:- New Repository Created - If the new repo matches a suborg, settings are applied immediately
- SubOrg Config Modified - When you modify a suborg YAML file, all matching repos are updated
- Org Settings Modified - When org settings change, the merged config (org + suborg) is applied
- Repository Joins SubOrg - When a repo starts matching suborg criteria (e.g., team added, custom property set)
What happens when a repo joins or leaves a suborg?
What happens when a repo joins or leaves a suborg?
Joining a SubOrg:
When a repository starts matching a suborg’s criteria (e.g., renamed to match pattern, team added, custom property set), the suborg settings are automatically applied on the next sync.Leaving a SubOrg:
If a repository no longer matches any suborg criteria, it will use only org-level settings. Previously applied suborg settings are not automatically removed, but will be overwritten by org-level settings on the next sync.
How do I test suborg settings before applying?
How do I test suborg settings before applying?
Create a pull request with your suborg changes. Safe Settings will run in dry-run mode and show you exactly what would change without actually applying anything. Check the PR comments and check run for details.
Can a repository belong to multiple suborgs?
Can a repository belong to multiple suborgs?
No. If Safe Settings detects that a repository matches multiple suborg configurations, it will throw an error:You need to adjust your suborg definitions to ensure they don’t overlap.
Best Practices
Use Descriptive Names
Name your suborg files after the team or purpose (e.g.,
frontend-team.yml, security-critical.yml, mobile-apps.yml).Avoid Overlaps
Ensure repository matching criteria don’t overlap between suborgs. A repo can only belong to one suborg.
Use CODEOWNERS
Use CODEOWNERS to ensure the right team approves changes to their suborg configuration:
Document Membership
Add comments to explain why certain repos are grouped together and what policies apply.
Troubleshooting
My suborg settings aren't being applied
My suborg settings aren't being applied
Check:
- Is the repository actually matching your suborg criteria? Check repo name patterns, team membership, or custom properties.
- Is there a repo-specific config overriding the suborg settings?
- Check the Safe Settings check run in the admin repo for errors.
Getting 'Multiple suborg configs' error
Getting 'Multiple suborg configs' error
This means a repository matches multiple suborg configurations. Review your suborg files and ensure the matching criteria (repo patterns, teams, properties) don’t overlap.
How do I see which repos belong to a suborg?
How do I see which repos belong to a suborg?
Safe Settings doesn’t provide a direct query. However, you can:
- Check your suborg YAML file for the matching criteria
- Use GitHub API or CLI to find repos matching your patterns
- Review the Safe Settings logs or check runs when the suborg config is applied
Next Steps
Repo Settings
Override settings for individual repositories
Configuration Hierarchy
Learn how settings are merged
Deployment Settings
Configure validators and restrictions
Sample SubOrg
View sample suborg file