GitLab API icon

GitLab API

Gitlab

Actions917

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 file differences for a commit identified by its SHA or branch/tag name in a given project.

Use Case Examples

  1. Fetch the diff of a commit by SHA to analyze code changes before deployment.
  2. Retrieve commit diffs to generate reports on code modifications for auditing purposes.

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 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 required and optional parameters for the API request, including project ID, commit SHA, pagination, and diff format.
Query Parameters Optional query parameters for pagination and diff format (page, per_page, unidiff).
Path Parameters Required path parameters specifying the project ID and commit SHA or branch/tag name.

Output

JSON

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

Dependencies

  • GitLab API authentication token or API key credential

Troubleshooting

  • Ensure the project ID and commit SHA/path are correctly URL-encoded and valid to avoid 404 errors.
  • Check API authentication credentials if receiving 401 Unauthorized errors.
  • Verify that the GitLab instance base URL is correct and accessible.
  • Pagination parameters (page, per_page) should be valid integers to avoid request errors.

Links

Discussion