GitLab API

GitlabTool

Actions905

Overview

This node operation retrieves the changes of a specific merge request in a GitLab project using the GitLab API v4. It is useful for developers and DevOps engineers who want to programmatically access the diff or changes introduced by a merge request to review code modifications or automate workflows based on merge request content.

Use Case Examples

  1. Fetch the list of file changes in a merge request to display in a custom dashboard.
  2. Automatically trigger code quality checks on the changed files of a merge request.
  3. Integrate merge request changes into a CI/CD pipeline for further processing.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
Authentication The authentication method used for the API request, typically an API key credential.
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 Optional query parameters for the request, including 'unidiff' to specify if the diff should be in Unified diff format.
Path Parameters Required path parameters identifying the project and merge request: 'id' is the project ID or URL-encoded path, and 'merge_request_iid' is the internal ID of the merge request.

Output

JSON

  • changes - List of changes in the merge request, including file diffs and metadata.

Dependencies

  • GitLab API authentication token or API key credential

Troubleshooting

  • Ensure the project ID and merge request IID are correctly specified and URL-encoded if necessary.
  • Verify that the authentication token has sufficient permissions to access the project's merge requests.
  • Check the base URL if using a self-hosted GitLab instance instead of gitlab.com.
  • If the 'unidiff' query parameter is used, ensure it is a boolean value; otherwise, the API may reject the request.

Links

Discussion