GitLab API

GitlabTool

Actions1000

Overview

This node operation interacts with the GitLab API to find the common ancestor (merge base) of multiple refs (branches or commits) in a project's repository. It is useful in scenarios where you need to determine the base commit for merging branches, such as in CI/CD pipelines, code review automation, or repository management tasks.

Use Case Examples

  1. Finding the merge base of two branches before creating a merge request.
  2. Automating checks that require the common ancestor commit of multiple refs in a project repository.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request.
Authentication Type of authentication used, 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 request, default is GET.
Query Parameters Query parameters for the request, specifically the refs to find the common ancestor of.
Path Parameters Path parameters for the request, specifically the project ID or URL-encoded path.

Output

JSON

  • merge_base_commit - The commit object representing the common ancestor (merge base) of the specified refs.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID or path is correct and accessible with the provided authentication.
  • Verify that the refs parameter is correctly formatted and includes valid branch or commit names.
  • Check network connectivity and baseUrl correctness if the GitLab instance is self-hosted.
  • Common errors include authentication failures, invalid project ID, or refs not found; resolving these involves verifying credentials, project existence, and ref names.

Links

Discussion