GitLab API

GitlabTool

Actions905

Overview

This node operation retrieves the diffs of a specific merge request in a GitLab project using the GitLab API. It is useful for developers and DevOps engineers who want to programmatically access the changes introduced by a merge request, such as for code review automation, CI/CD pipelines, or audit purposes. For example, it can be used to fetch the diff of a merge request to display in a custom dashboard or to trigger further automated testing based on the changes.

Use Case Examples

  1. Fetch the diff of merge request IID 42 in project ID 'my-group/my-project' to analyze code changes before merging.
  2. Retrieve paginated diffs of a merge request to process large diffs in chunks.

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 to use for the request, default is GET.
Parameter Schema Defines the required and optional parameters for the API call, including project ID, merge request IID, pagination, and diff format options.
Query Parameters Optional query parameters such as page number, items per page, and whether to return a unified diff format.
Path Parameters Required path parameters including the project ID and the merge request IID to identify the specific merge request.

Output

JSON

  • diffs - Array of diff objects representing the changes in the merge request.
  • pagination
    • page - Current page number of the results.
    • per_page - Number of items per page.
    • total - Total number of diff items available.

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 API authentication token has sufficient permissions to access the project's merge requests.
  • Check the base URL to ensure it points to the correct GitLab instance, especially if using a self-hosted GitLab server.
  • If pagination parameters are used, ensure they are valid integers to avoid API errors.

Links

Discussion