GitLab API icon

GitLab API

Gitlab

Actions880

Overview

This node operation retrieves the diff of a specific commit in a GitLab project's repository using the GitLab API v4. It is useful for developers or 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.

Use Case Examples

  1. Fetch the diff of a commit identified by its SHA in a GitLab project to analyze code changes before merging.
  2. Automate retrieval of commit diffs to generate reports on code modifications for compliance or documentation purposes.

Properties

Name Meaning
Skip Authentication Option to skip authentication when making the API request.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the request, default is GET.
Query Parameters Optional query parameters for the request such as page number, items per page, and unified diff format.
Path Parameters Required path parameters identifying the project and commit SHA.

Output

JSON

  • diffs - Array of file diffs included in the commit.
  • commit_id - The SHA of the commit.
  • project_id - The ID of the project the commit belongs to.
  • pagination
    • page - Current page number of the results.
    • per_page - Number of items per page in the results.

Dependencies

  • GitLab API authentication token or credentials

Troubleshooting

  • Ensure the project ID and commit SHA 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 repository commits.
  • If pagination parameters are used, ensure they are valid integers to avoid request errors.

Links

Discussion