GitLab API icon

GitLab API

Gitlab

Actions1062

Projects → headApiV4ProjectsIdRepositoryFilesFilePath

AI-generated

Summary

Check for the existence of a specific file in a GitLab project repository at a given branch, tag, or commit reference by sending a HEAD request to the GitLab API.

Inputs

  • id (required) — The project ID or URL-encoded path identifying the GitLab project.
  • file_path (required) — The URL-encoded path to the file within the repository.
  • ref (required) — The name of the branch, tag, or commit to check the file against.
  • skipAuthentication — Boolean flag to skip authentication; defaults to false.
  • baseUrl — The base URL of the GitLab instance; defaults to 'https://gitlab.com'.

Output shape

no body — success/failure only

The operation returns HTTP status only: a successful status indicates the file exists at the specified ref, while a failure status indicates it does not or is inaccessible.

Examples

Example 1: Verify if a file exists in a project repository's main branch

Set 'id' to the project path, 'file_path' to the file path, and 'ref' to 'main' to check file existence without retrieving file content.

Links

Discussion