protect_branch
Apply protection rules to a GitLab branch by specifying access levels for push, merge, and unprotect actions. Uses dry-run mode to preview changes before execution.
Instructions
Protect a branch with given push/merge/unprotect access levels. Access levels: 0=NoAccess, 30=Developer, 40=Maintainer, 60=Admin. dry_run=true by default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | Project ID | |
| name | Yes | Branch name or wildcard pattern (e.g. 'main', 'release/*') | |
| push_access_level | No | Minimum role required to push (default: 40=Maintainer) | |
| merge_access_level | No | Minimum role required to merge (default: 40=Maintainer) | |
| unprotect_access_level | No | Minimum role required to unprotect (default: 40=Maintainer) | |
| dry_run | No | Dry run mode (default: true). When true, returns a preview of the action without executing it. Set to false only after user confirmation. |