GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node operation performs a HEAD request to the GitLab API endpoint for checking the existence and metadata of a specific branch in a project's repository. It is useful for scenarios where you need to verify if a branch exists or retrieve branch metadata without fetching the full branch details. For example, it can be used in CI/CD pipelines to conditionally trigger jobs based on branch presence or in automation workflows to validate branch states before proceeding.

Use Case Examples

  1. Check if a branch named 'feature-xyz' exists in a project with ID '12345' before deploying code.
  2. Verify branch metadata to ensure compliance with naming conventions or branch protection rules in a GitLab project.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public repositories or endpoints that do not require authentication.
Authentication Type of authentication used for the request, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the request, defaulting to GET but can be set to HEAD for this operation.
Path Parameters Parameters required in the URL path to specify the project and branch.

Output

JSON

  • statusCode - HTTP status code of the HEAD request indicating branch existence or access status
  • headers - HTTP headers returned by the HEAD request containing branch metadata and other response details

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID and branch name are correctly URL-encoded to avoid 404 errors.
  • If authentication is required, verify that the GitLab API key credential is valid and has sufficient permissions to access the project repository.
  • A 404 status code indicates the branch does not exist or the project is inaccessible with the provided credentials.
  • A 401 or 403 status code indicates authentication or permission issues; check API key validity and access rights.

Links

Discussion