GitLab API icon

GitLab API

Gitlab

Actions880

Overview

This node operation retrieves the protected branches of a specific project in GitLab using the GitLab API v4. It is useful for scenarios where you need to manage or audit branch protection settings in a GitLab project, such as checking which branches are protected to enforce workflow policies or automate branch management tasks.

Use Case Examples

  1. Fetching all protected branches of a project to display in a dashboard.
  2. Automating checks on branch protection before allowing merges or deployments.

Properties

Name Meaning
Skip Authentication Option to skip authentication when making the API request.
Authentication The authentication method used for the API request, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the API request, defaulting to GET.
Query Parameters Optional query parameters to control pagination and search for protected branches.
Path Parameters Path parameters specifying the project ID or URL-encoded path.

Output

JSON

  • id - The unique identifier of the protected branch.
  • name - The name of the protected branch.
  • push_access_levels - Access levels that are allowed to push to the branch.
  • merge_access_levels - Access levels that are allowed to merge into the branch.
  • unprotect_access_levels - Access levels that are allowed to unprotect the branch.
  • allow_force_push - Indicates if force push is allowed on the branch.
  • code_owner_approval_required - Indicates if code owner approval is required for the branch.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID or URL-encoded path is correct to avoid 404 errors.
  • Verify that the API key has sufficient permissions to access project protected branches.
  • Check the base URL if using a self-hosted GitLab instance to avoid connection errors.
  • If skipping authentication, ensure the GitLab instance allows unauthenticated access to this endpoint.

Links

Discussion