GitLab API

GitlabTool

Actions1000

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 commit message, author, 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 development dashboards to track changes and commit metadata.

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 when making the API request.
Authentication The authentication method used for the API request, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method used for the API request, defaulting to GET.
Query Parameters Optional query parameters for the API request, including 'stats' to include commit statistics.
Path Parameters Path parameters required for the API 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 unique identifier of the commit.
  • short_id - A shortened version of the commit SHA.
  • title - The commit title or message.
  • author_name - Name of the commit author.
  • author_email - Email of the commit author.
  • created_at - Timestamp when the commit was created.
  • message - Full commit message.
  • 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

Troubleshooting

  • Ensure the project ID and commit SHA/path are correctly URL-encoded to avoid 404 errors.
  • If authentication is required, verify that the GitLab API key credential is correctly configured and has sufficient permissions.
  • Check the base URL if using a self-hosted GitLab instance to avoid connection errors.
  • If the 'stats' query parameter is set, ensure the commit exists and stats are available to avoid incomplete data.

Links

Discussion