GitLab API

GitlabTool

Actions905

Overview

This node operation retrieves detailed information about a specific commit in a GitLab project repository using the GitLab API v4. It is useful for scenarios where you need to fetch commit details such as author, message, date, and optionally commit statistics for a given commit SHA or branch/tag name within a project. For example, it can be used in CI/CD pipelines, audit logs, or version tracking workflows.

Use Case Examples

  1. Fetch commit details by providing the project ID and commit SHA to monitor changes in a repository.
  2. Retrieve commit statistics to analyze code changes for a specific commit in a project.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the API request.
Authentication Type of authentication used for the API request, defaulting to GitLab API key authentication.
baseUrl Base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method used for the API request, default is GET.
Query Parameters Optional query parameters for the request, including 'stats' to include commit statistics.
Path Parameters Path parameters required for the request, including 'id' for the project ID or URL-encoded path, and 'sha' for the commit SHA or branch/tag name.

Output

JSON

  • id - The commit ID (SHA) retrieved from the GitLab repository.
  • short_id - Shortened version of the commit ID.
  • title - Title or message of the commit.
  • author_name - Name of the commit author.
  • author_email - Email of the commit author.
  • committed_date - Date and time when the commit was made.
  • stats
    • additions - Number of lines added in the commit (if stats included).
    • deletions - Number of lines deleted in the commit (if stats included).
    • total - Total number of changes in the commit (if stats included).

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID and commit SHA or branch/tag name are correctly provided; otherwise, the API will return an error.
  • If authentication is skipped, ensure the GitLab instance allows unauthenticated requests or the request will fail.
  • Common error messages include 404 Not Found if the commit or project does not exist, and 401 Unauthorized if authentication fails. Verify credentials and permissions.

Links

Discussion