Skip to content

Enforces who can approve changes#951

Merged
benoit-cty merged 1 commit into
masterfrom
feat/security/limit-merge
Oct 24, 2025
Merged

Enforces who can approve changes#951
benoit-cty merged 1 commit into
masterfrom
feat/security/limit-merge

Conversation

@benoit-cty

@benoit-cty benoit-cty commented Oct 13, 2025

Copy link
Copy Markdown
Contributor

Description

The CODEOWNERS file actually serves both purposes - it automatically requests reviews AND enforces who can approve changes when combined with GitHub's branch protection rules.

To achieve what you want (only @mlco2/core-maintainers can merge), you need to:

Keep the CODEOWNERS file as is - it's already correct
Configure branch protection rules in GitHub repository settings:
Go to: Settings → Branches → Branch protection rules
Add/edit rule for master (or your main branch)
Enable: "Require review from Code Owners"
Enable: "Require approvals" (set to at least 1)
Optionally enable: "Dismiss stale pull request approvals when new commits are pushed"
With these settings:

✅ Only members of @mlco2/core-maintainers can approve PRs
✅ PRs cannot be merged without approval from code owners
✅ Other contributors can review/comment but cannot approve/merge
The CODEOWNERS file you have is already set up correctly for this purpose. The enforcement happens through GitHub's branch protection settings, not the CODEOWNERS file itself.

Related Issue

Will close #865

Motivation and Context

Limit who could merge to master, so we could add more people as contributors.

How Has This Been Tested?

image

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@benoit-cty benoit-cty requested a review from a team October 13, 2025 19:20
@benoit-cty benoit-cty changed the title enforces who can approve changes Enforces who can approve changes Oct 13, 2025
@benoit-cty benoit-cty force-pushed the feat/security/limit-merge branch from bcbfcf8 to 8297adf Compare October 24, 2025 08:13
@benoit-cty benoit-cty merged commit a41c49b into master Oct 24, 2025
5 checks passed
@benoit-cty benoit-cty deleted the feat/security/limit-merge branch October 24, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limit ability to merge to master to a list of maintainers : Add a CODEOWNERS file

2 participants