GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node operation creates a new merge request in a specified GitLab project using the GitLab API. It is useful for automating the process of initiating merge requests in GitLab repositories, which is a common task in continuous integration and development workflows. For example, it can be used to programmatically open merge requests for feature branches or bug fixes without manual intervention.

Use Case Examples

  1. Automatically create a merge request when a new feature branch is pushed to a GitLab repository.
  2. Trigger a merge request creation as part of a CI/CD pipeline after successful build and test stages.

Properties

Name Meaning
Skip Authentication Option to skip API authentication for the request.
Authentication Type of authentication used for the API request, defaulting to GitLab API key authentication.
baseUrl Base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method used for the API request, default is GET but POST is used for creating merge requests.
Path Parameters Parameters included in the API request path, specifically the project ID or URL-encoded path required to identify the project for the merge request.

Output

JSON

  • id - The unique identifier of the created merge request.
  • iid - Internal ID of the merge request within the project.
  • project_id - ID of the project where the merge request is created.
  • title - Title of the merge request.
  • description - Description or body content of the merge request.
  • state - Current state of the merge request (e.g., opened, closed, merged).
  • created_at - Timestamp when the merge request was created.
  • updated_at - Timestamp when the merge request was last updated.
  • merge_status - Status of the merge request regarding mergeability.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID or URL-encoded path is correctly provided in the path parameters; otherwise, the API call will fail.
  • Verify that the authentication credentials are valid and have sufficient permissions to create merge requests in the target project.
  • Check the base URL if using a self-hosted GitLab instance to avoid connection errors.
  • Common error messages include 401 Unauthorized (invalid or missing credentials), 404 Not Found (incorrect project ID or path), and 400 Bad Request (invalid request body). Resolving these involves correcting credentials, project identifiers, or request payloads.

Links

Discussion