AI CodeOps

Rulesets

A ruleset is a named list of rules GitHub applies to branches or tags. How rulesets differ from branch protection rules, and how they apply to AI CodeOps PRs.

A ruleset is a named list of rules that GitHub enforces on branches or tags in a repository, or across an organization. It's the newer, more flexible way to protect branches, next to classic branch protection rules (About rulesets).

What it is

Rulesets differ from branch protection rules in a few ways:

  • Several can apply at once. Only one branch protection rule applies to a branch, but many rulesets can, and they layer with branch protection. The most restrictive rule wins.
  • They can be switched off without being deleted, by changing their enforcement status.
  • Bypass is explicit. A ruleset lists who may bypass it, by role, team or GitHub App.
  • Anyone with read access can view a repository's active rulesets, so developers and auditors can see the rules without admin rights.
  • They can target tags and control commit metadata, such as commit messages and author emails.

GitHub offers rulesets on its Team and Enterprise plans. Rulesets that target many repositories at the organization level need Enterprise.

Why it matters

Layered, visible rules make it easier to set a baseline for every repository and add stricter rules where they're needed, then show an auditor exactly what applies.

In AI CodeOps

AI CodeOps doesn't read or create rulesets. A session's change arrives as a pull request from its own branch, and merging from the console uses the provider's normal merge API, so your rulesets apply as they would to any pull request.

Frequently asked questions

Can I use rulesets and branch protection rules together?

Yes. They layer, and where they conflict the most restrictive rule applies.

Are rulesets the same as the AI CodeOps workspace policy?

No. Rulesets govern your repository on GitHub. The workspace policy governs what AI sessions may do, such as call tools, open pull requests or deploy.