Roles for admins and editors
Set up roles in GitHub so editors change only content and admins own the code, the schema and the settings. Editlet
has no roles of its own. GitHub enforces the rules for the editor, your agent and plain git alike.
Your agent can do the setup: ask it to "set up roles for editors and admins". It writes .github/CODEOWNERS and runs
each GitHub change only after you say yes (The agent skills).
What you get
| Who | Can | Cannot |
|---|---|---|
Editors (team editors, role Write) | Edit content on editlet/* branches, open pull requests, approve other editors' content if you allow it | Create other branches, push code (private repositories), merge code without an admin |
Admins (team admins, role Admin or Maintain) | Everything | Merge their own change without another person's approval |
Rulesets and CODEOWNERS work on every plan for public repositories. Private repositories need GitHub Team or
Enterprise (GitHub Pro on a personal account). Push rules (step 5) work only in private repositories on GitHub Team
or Enterprise. A personal account has no teams: name people instead.
1. Create the teams
In your organization, create two visible teams. Give admins the Admin or Maintain role on the repository and
editors the Write role.
2. Add .github/CODEOWNERS
# Code, schema, settings: admins
* @acme/admins
# Content and the images next to entries: editors or admins
/cms/content/ @acme/editors @acme/admins
# Keep last: only admins change the owners
/.github/CODEOWNERS @acme/adminsThe last matching line wins, and any one owner on a line can approve. To let only admins approve content, remove the
/cms/content/ line. cms/schema.json is outside cms/content/, so a schema change always waits for an admin.
Merge this file before step 3, because GitHub reads it from the base branch.
3. Protect the base branch
In Settings → Rules → Rulesets, create a branch ruleset for the base branch with no bypass:
- Require a pull request with 1 approval and Require review from Code Owners.
- Require approval of the most recent reviewable push, so nobody approves their own change.
- Dismiss stale approvals, restrict deletions and block force pushes.
4. Let editors create only editlet/ branches
Create a branch ruleset for all branches, exclude editlet/**/*, add Restrict creations and let the admins
team bypass it. Use your git.branchPrefix if the schema sets another one.
5. Let editors push only content (private repositories)
Create a push ruleset with Restrict file paths set to **/*, .* and .*/**/*. Allow cms/content/**/* and
let admins bypass it. A public repository has no push rules, so there CODEOWNERS holds code changes for an admin.
Things to know
- Write lets editors merge. Anyone with Write can merge once every rule passes. If only admins should publish, let only admins approve content.
- One admin cannot get another approval. Add a second admin, or let
adminsbypass the base ruleset for pull requests only. - The editor shows, GitHub decides. The editor shows your role (Admin or Editor) next to your login. It names the code owners who must approve before you save. For editors it collapses the list of code files a merge brings in.
For agents: this page as Markdown · llms.txt