GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node operation retrieves the diffs 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 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 review code changes before merging.
  2. Automate retrieval of merge request diffs to integrate with a custom code quality analysis tool.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
Authentication The authentication method to use for the API request, typically an API key credential.
baseUrl The base URL of the GitLab instance to send the API request to, defaulting to https://gitlab.com.
Method The HTTP method to use for the API request, default is GET.
Parameter Schema Defines the parameters required and optional for the API request, including project ID, merge request IID, pagination, and diff format options.
Query Parameters Optional query parameters to control pagination and diff format, including page number, items per page, and unified diff format flag.
Path Parameters Required path parameters specifying the project ID and the merge request IID to identify the merge request whose diffs are to be retrieved.

Output

JSON

  • diffs - Array of diff objects representing the changes in the merge request
  • commit_id - The commit ID associated with the diff
  • start_commit_id - The start commit ID for the diff range
  • end_commit_id - The end commit ID for the diff range

Dependencies

  • GitLab API authentication credential

Troubleshooting

  • Ensure the project ID and merge request IID are correct and accessible with the provided credentials.
  • Check that the base URL is correct for the GitLab instance being accessed.
  • Verify that the authentication token has sufficient permissions to read merge request diffs.
  • If pagination parameters are used, ensure they are valid integers and within allowed ranges.

Links

Discussion