GitLab API icon

GitLab API

Gitlab

Actions880

Overview

This node operation interacts with the GitLab API to find the common ancestor (merge base) of multiple refs in a project's repository. It is useful in scenarios where you need to determine the base commit for merging branches or comparing code changes in a GitLab project. For example, it can be used in CI/CD pipelines to automate merge conflict detection or to analyze branch histories.

Use Case Examples

  1. Find the merge base of 'main' and 'feature-branch' refs in a GitLab project to prepare for a merge.
  2. Determine the common ancestor commit of multiple branches to facilitate code review or integration testing.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request.
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, defaulting to GET.
Query Parameters Query parameters for the request, specifically the 'refs' parameter which is an array of refs to find the common ancestor of.
Path Parameters Path parameters for the request, specifically the 'id' parameter which is the ID or URL-encoded path of the project.

Output

JSON

  • id - The ID or URL-encoded path of the project used in the request path.
  • refs - The refs (branches or tags) passed as query parameters to find their common ancestor.
  • 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 URL-encoded path is correct to avoid 404 Not Found errors.
  • Verify that the refs parameter is provided and correctly formatted as an array of strings.
  • Check that the GitLab API key credential is valid and has sufficient permissions to access the project repository.
  • Common error messages include authentication failures, invalid project ID, or missing required parameters. Resolving these involves verifying credentials, input parameters, and API endpoint correctness.

Links

Discussion