GitLab API

GitlabTool

Actions1000

Overview

This node operation interacts with the GitLab API to compare two points in a project's repository, such as commits, branches, or tags. It is useful for developers and DevOps teams who want to programmatically analyze differences between code states in a GitLab project, for example, to review changes before merging or to generate diffs for code review.

Use Case Examples

  1. Compare the 'main' branch with a 'feature' branch in a specific GitLab project to see the changes introduced by the feature branch.
  2. Compare two commits in a project repository to generate a unified diff for patch creation or review.

Properties

Name Meaning
Skip Authentication Option to skip API authentication, useful for public repositories or testing without credentials.
Authentication Type of authentication used for the API call, defaulting to GitLab API key authentication.
baseUrl Base URL of the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the API request, default is GET.
Query Parameters Parameters to specify the comparison details such as the starting point ('from'), ending point ('to'), optional project ID for cross-project comparison, comparison method, and output format.
Path Parameters Path parameter specifying the project ID or URL-encoded path to identify the project to compare in the repository.

Output

JSON

  • commit - Details of the commit at the 'to' point in the comparison.
  • commits - List of commits between 'from' and 'to' points.
  • diffs - List of file diffs between the compared points.
  • compare_timeout - Indicates if the comparison operation timed out.
  • compare_same_ref - Indicates if the 'from' and 'to' points are the same.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID or path is correct and accessible with the provided authentication.
  • Verify that the 'from' and 'to' parameters are valid commit SHAs, branch names, or tags in the project repository.
  • Check network connectivity and base URL correctness if the API call fails.
  • If skipping authentication, ensure the repository is public or accessible without credentials.

Links

Discussion