GitLab API

GitlabTool

Actions1000

Overview

This node operation retrieves a list of branches from a specific GitLab project repository using the GitLab API v4. It is useful for scenarios where you need to programmatically access branch information such as branch names, filtering branches by search criteria or regex, sorting branches, and handling pagination. For example, it can be used in CI/CD pipelines to fetch branch details or in automation workflows to monitor repository branches.

Use Case Examples

  1. Fetch all branches of a project to display in a dashboard.
  2. Search for branches matching a specific pattern to trigger automated tests.
  3. Paginate through branches to process them in batches.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request.
Authentication Type of authentication used, default is GitLab API key.
baseUrl Base URL of the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the request, default is GET.
Query Parameters Optional query parameters to filter and paginate the branches list.
Path Parameters Path parameters for the request, specifically the project ID or URL-encoded path.

Output

JSON

  • id - Unique identifier of the branch.
  • name - Name of the branch.
  • commit
    • id - Commit ID associated with the branch.
    • message - Commit message of the latest commit on the branch.
    • author_name - Author name of the latest commit.
    • authored_date - Date when the latest commit was authored.
  • merged - Indicates if the branch has been merged.
  • protected - Indicates if the branch is protected.
  • developers_can_push - Indicates if developers can push to the branch.
  • developers_can_merge - Indicates if developers can merge to the branch.
  • can_push - Indicates if the current user can push to the branch.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID or URL-encoded path is correct to avoid 404 errors.
  • Check that the GitLab API key credential is valid and has sufficient permissions to access the repository branches.
  • If pagination parameters are used, verify that page and per_page values are within allowed ranges to avoid empty or partial results.
  • If using search or regex filters, ensure the syntax is correct to get expected branch results.

Links

Discussion