GitLab API

GitlabTool

Actions905

Overview

This node operation performs a HEAD request to the GitLab API to check the existence and metadata of a specific file in a project's repository. It is useful for scenarios where you want to verify if a file exists in a GitLab project repository without downloading the file content, such as validating file presence before further processing or automation.

Use Case Examples

  1. Check if a configuration file exists in a GitLab project repository before triggering a deployment pipeline.
  2. Verify the presence of a README file in multiple projects to ensure documentation standards.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request.
Authentication Type of authentication used, default is GitLab API key.
baseUrl Base URL of the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the request, default is GET but HEAD is used for this operation.
Query Parameters Query parameters for the request, specifically the 'ref' which is the name of the branch, tag, or commit to reference the file.
Path Parameters Path parameters for the request including the project ID and the URL encoded file path.

Output

JSON

  • headers - HTTP response headers containing metadata about the file if it exists
  • statusCode - HTTP status code of the HEAD request indicating file existence (e.g., 200 if file exists, 404 if not)

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID and file path are correctly URL encoded and valid.
  • Verify that the 'ref' query parameter corresponds to an existing branch, tag, or commit in the repository.
  • Authentication errors may occur if the API key is missing or invalid; ensure proper credentials are configured.
  • A 404 status code indicates the file does not exist at the specified path and ref.

Links

Discussion