GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node operation retrieves information about a specific branch in a GitLab project's repository using the GitLab API v4. It is useful for scenarios where you need to get details about a particular branch, such as its commit history, protection status, or other metadata. For example, it can be used in CI/CD pipelines to verify branch details before deployment or in project management tools to display branch information.

Use Case Examples

  1. Get details of the 'main' branch in a project with ID '12345' to check its latest commit.
  2. Fetch branch information to verify if a branch is protected before allowing merges.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
Authentication The authentication method used for the API request, typically an API key credential.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method used for the API request, default is GET.
Path Parameters Parameters used in the API request path to specify the project and branch.

Output

JSON

  • id - The unique identifier of the branch.
  • name - The name of the branch.
  • commit
    • id - The commit ID the branch is pointing to.
    • message - The commit message of the latest commit on the branch.
  • protected - Indicates if the branch is protected.
  • merged - Indicates if the branch has been merged.
  • default - Indicates if the branch is the default branch of the project.

Dependencies

  • GitLab API authentication token or API key credential

Troubleshooting

  • Ensure the project ID and branch name are correctly URL-encoded and valid.
  • Authentication errors may occur if the API key or token is missing or invalid; verify credentials.
  • Check the base URL if using a self-hosted GitLab instance instead of gitlab.com.
  • API rate limits may cause request failures; consider handling rate limit responses.

Links

Discussion