GitLab API

GitlabTool

Actions905

Overview

This node operation retrieves the diff of a specific commit in a GitLab project repository using the GitLab API v4. It is useful for developers and DevOps engineers who want to programmatically access the changes introduced by a particular commit, such as for code review automation, CI/CD pipelines, or audit logging. For example, it can fetch the diff of a commit identified by its SHA or branch/tag name, supporting pagination and unified diff format options.

Use Case Examples

  1. Fetch the diff of a commit by SHA to review code changes before merging.
  2. Automate retrieval of commit diffs in a CI pipeline to generate change logs.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
Authentication The authentication method used for the API request, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method to use for the API request, defaulting to GET.
Parameter Schema Defines the required and optional parameters for the API call, including project ID, commit SHA, pagination, and diff format options.
Query Parameters Optional query parameters for pagination (page, per_page) and diff format (unidiff).
Path Parameters Path parameters specifying the project ID and commit SHA or branch/tag name.

Output

JSON

  • diffs - Array of file diffs in the commit, showing changes made.
  • commit_id - The SHA identifier of the commit.
  • project_id - The ID of the GitLab project.
  • page - Current page number of the paginated response.
  • per_page - Number of items per page in the response.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID and commit SHA are correctly URL-encoded and valid to avoid 404 errors.
  • Check authentication credentials if receiving 401 Unauthorized errors.
  • Verify pagination parameters to avoid empty or incomplete results.

Links

Discussion