GitLab API

GitlabTool

Actions1000

Overview

This node operation allows users to create a new merge request in a specified GitLab project by making a POST request to the GitLab API endpoint `/api/v4/projects/{id}/merge_requests`. It is useful for automating the process of initiating merge requests in GitLab projects, which is a common task in software development workflows involving code review and collaboration.

Use Case Examples

  1. Automatically create a merge request when a feature branch is ready for review.
  2. Integrate with CI/CD pipelines to open merge requests based on build or test results.

Properties

Name Meaning
Skip Authentication Determines whether to skip authentication for the API request.
Authentication Specifies the authentication method to use, typically a GitLab API key credential.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method to use for the request, default is GET but POST is used for this operation.
Path Parameters Parameters included in the 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 details 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 of the last update to the merge request.
  • web_url - URL to view the merge request in GitLab web interface.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID provided in path parameters is correct and accessible with the authenticated user.
  • Verify that the authentication credentials are valid and have sufficient permissions to create merge requests.
  • Check the request body schema to ensure all required fields for creating a merge request are included and correctly formatted.
  • Common error messages include 401 Unauthorized (authentication failure), 404 Not Found (invalid project ID), and 400 Bad Request (invalid or missing parameters). Resolving these involves correcting credentials, project ID, or request data.

Links

Discussion