Implement the ability to add branch Protections
Description
As part of the MVC for organizing rules based on branches, we need to implement the ability to add branch protections.
Scope
The scope of this issue includes:
-
Implement branch/wildcard dropdown- Handled by #388128 (closed)
- Implement the Access level dropdowns
- Implement Push access checkbox
- Implement 'realtime' saving (use existing endpoint)
Implementation plan
Update editBranchRule
mutation to include these fields
Mockups
Allowed to merge
- Allows editing of roles, users, and groups
- Default:
- Roles: Administrators, Maintainers
- Empty state text: No one is allowed to merge changes.
- On change, display toast "Allowed to merge updated"
- Undo action would be nice to have.
Default | Edit - default | Edit - filled | Allowed to merge updated |
---|---|---|---|
Allowed to push and merge
- Allows editing of roles, users, groups, and deploy keys
- Default: (empty)
- Empty state text: Everyone is required to submit a merge request for changes.
- On change, display toast "Allowed to push and merge updated"
- Undo action would be nice to have.
Default | Edit - filled | Allowed to push and merge updated |
---|---|---|
Toggles
-
Allow force push
toggle is only displayed when there "allowed to push and merge" is populated- Default off
-
Requires code owner approval
- Default off
- Toast displayed when toggle changes
Allow force push enabled | Require code owners approval enabled |
---|---|
Everyone is required to submit a merge request for changes
It is not obvious that you need to set roles to "No one" in protected branches to enforce the fact that everyone is required to submit a merge request for changes. Here is our guidance in our docs. This is compounded by the fact that you could select a role as "No one" but still include users and groups - selecting the role of "No one" is redundant in this scenario.
To help with convey this scenario to make it clear for users who want to enforce merge requests for branches like these related issues Branch protection rule: Require a pull request ... (#384939 - closed) and Introduce a direct way to require merge request... (#388102)
Introducing toggle to require merge request | Toggled true | "Everyone is required to submit a merge request" |
---|---|---|