GitLab API

GitlabTool

Actions1000

Overview

This node operation performs a HEAD request to the GitLab API endpoint that checks for 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. For example, it can be used in CI/CD pipelines or automation workflows to conditionally trigger actions based on the presence of certain files in the repository.

Use Case Examples

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

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request.
Authentication Type of authentication used, 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 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 check the file against.
Path Parameters Path parameters for the request, including 'id' for the project ID and 'file_path' for the URL encoded path to the file in the repository.

Output

JSON

  • statusCode - HTTP status code of the HEAD request indicating file existence or error.
  • headers - HTTP headers returned by the HEAD request containing metadata about the file if it exists.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the 'id' and 'file_path' path parameters are correctly URL encoded and valid for the target GitLab project.
  • Verify that the 'ref' query parameter corresponds to an existing branch, tag, or commit in the repository.
  • If authentication is required, ensure the GitLab API key credential is correctly configured and has sufficient permissions to access the project repository.
  • Common error messages include 404 Not Found if the file does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion