GitLab API

GitlabTool

Actions1000

Overview

This node operation retrieves information about a specific protected branch in a GitLab project using the GitLab API. It is useful for scenarios where you need to check branch protection settings, such as permissions and restrictions, for a particular branch within a project. For example, a developer or DevOps engineer might use this to verify branch protection rules before merging code.

Use Case Examples

  1. Retrieve details of the 'main' protected branch in the 'gitlab-org/gitlab' project to verify its protection settings.
  2. Check the protection status of a feature branch in a project to ensure compliance with team policies.

Properties

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

Output

JSON

  • id - The ID of the protected branch.
  • name - The name of the protected branch.
  • push_access_levels - Access levels allowed to push to the branch.
  • merge_access_levels - Access levels allowed to merge into the branch.
  • unprotect_access_levels - Access levels allowed to unprotect the branch.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID and branch name are correctly URL-encoded and valid, as incorrect values will cause API errors.
  • If authentication is enabled, verify that the GitLab API key credential is correctly configured and has sufficient permissions to access the project and branch information.
  • Check the base URL if using a self-hosted GitLab instance to ensure it is correct and accessible.
  • Common error messages include 404 Not Found if the project or branch does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion