GitLab API

GitlabTool

Actions905

Overview

This node operation retrieves a comparison between two commits, branches, or tags in a GitLab project repository. It is useful for developers and DevOps teams who want to see the differences between two points in a project's history, such as comparing feature branches to the main branch before merging. For example, it can be used to generate a diff report between a feature branch and the main branch to review code changes.

Use Case Examples

  1. Compare the 'main' branch with a 'feature' branch in a project to review changes before merging.
  2. Get a diff between two specific commits to understand what has changed.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the request.
Authentication The authentication method used, defaulting to GitLab API key.
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 parameters for the API call including project ID, from and to commits/branches/tags, and optional comparison settings.
Query Parameters Collection of query parameters for the comparison: 'from' commit/branch/tag, 'to' commit/branch/tag, optional 'from_project_id', 'straight' comparison flag, and 'unidiff' flag for unified diff format.
Path Parameters Collection of path parameters including the project ID or URL-encoded path.

Output

JSON

  • diffs - List of diffs between the compared commits/branches/tags.
  • commit_compare - Summary information about the comparison including commits and diffs.
  • compare_timeout - Indicates if the comparison operation timed out.
  • compare_same_ref - Indicates if the compared references are the same.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID or URL-encoded path is correct to avoid 404 errors.
  • Verify that the 'from' and 'to' parameters are valid commit SHAs, branch names, or tag names to prevent invalid comparison errors.
  • Check authentication credentials if receiving authorization errors.

Links

Discussion