Actions71
- Branch Actions
- File Actions
- Group Actions
- Issue Actions
- Merge Request Actions
- Pipeline Actions
- Project Actions
- Raw API Actions
- Release Actions
- Tag Actions
Branch → Protect
AI-generatedSummary
Creates or updates a protected branch in the specified GitLab project, restricting push and merge permissions.
Inputs
- Authentication — Select whether to use saved credentials or custom fields for this node (Optional, default: credential)
- server — Base URL of your GitLab instance, for example "https://gitlab.com" (Optional, default: https://gitlab.com)
- accessToken — Personal access token with API permissions (Optional)
- projectOwner — Namespace or owner of the project. Used when "Project Locator" is set to "Path". (Optional)
- projectName — Project slug or name. Used when "Project Locator" is set to "Path". (Optional)
- projectId — Numeric project ID. Used when "Project Locator" is set to "ID". (Optional, default: 0)
- projectLocator — Choose how to identify the project for project-scoped GitLab API endpoints (Optional, default: id)
- branch (required) — Branch name, for example 'feature/login'
- developersCanPush — Whether developers can push (Optional, default: false)
- developersCanMerge — Whether developers can merge (Optional, default: false)
Output shape
a list of items containing the API response data for the protected branch
The operation returns the full GitLab API response for the protected branch, which includes the configuration applied.
Examples
Example 1: Restrict a production branch to prevent direct pushes and force merges via pull requests
Branch: 'production', Developers Can Push: false, Developers Can Merge: false
Example 2: Allow developers to push to a staging branch but require approval before merging
Branch: 'staging', Developers Can Push: true, Developers Can Merge: false