GitLab API

GitlabTool

Actions1000

Overview

This node operation retrieves the list of protected branches for 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 ensuring compliance with development workflows or automating branch protection checks.

Use Case Examples

  1. Fetch all protected branches of a project identified by its ID or URL-encoded path.
  2. Search for protected branches by name within a project.
  3. Paginate through the list of protected branches to handle large projects.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public or unauthenticated access.
Authentication Type of authentication used, defaulting to GitLab API key authentication.
baseUrl Base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the request, default is GET.
Query Parameters Optional query parameters to control pagination and search within protected branches.
Path Parameters Path parameters specifying the project identifier.

Output

JSON

  • id - Unique identifier of the protected branch
  • name - Name of the protected branch
  • push_access_levels - Access levels allowed to push to the branch
  • merge_access_levels - Access levels allowed to merge into the branch
  • unprotect_access_levels - Access levels 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 pagination parameters are used, ensure they are valid integers to prevent request errors.

Links

Discussion