GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node operation retrieves the common ancestor (merge base) of multiple refs in a GitLab project's repository. It is useful for determining the base commit from which branches diverged, which is essential in merge conflict resolution, code review, and continuous integration workflows. For example, it can be used to find the merge base between feature branches and the main branch to understand changes and conflicts before merging.

Use Case Examples

  1. Find the merge base between 'feature-branch' and 'main' in a project to prepare for a merge.
  2. Determine the common ancestor commit of multiple refs to analyze the divergence point in a repository.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the request.
Authentication The authentication method used for the request, typically an API key credential for GitLab.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method used for the request, default is GET.
Query Parameters Query parameters for the request, specifically 'refs' which are the refs to find the common ancestor of. Multiple refs can be passed as a string.
Path Parameters Path parameters for the request, specifically 'id' which is the ID or URL-encoded path of the project.

Output

JSON

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

Dependencies

  • GitLab API authentication token or API key credential

Troubleshooting

  • Ensure the project ID or path is correct and URL-encoded if necessary to avoid 404 errors.
  • Verify that the refs parameter is provided and correctly formatted as a list of branch or tag names to avoid request errors.
  • Check that the authentication token has sufficient permissions to access the project repository.
  • Common error messages include 401 Unauthorized (authentication issues), 404 Not Found (invalid project ID or refs), and 400 Bad Request (malformed parameters). Resolving these involves verifying credentials, project existence, and parameter correctness.

Links

Discussion