GitLab API

GitlabTool

Actions905

Overview

This node interacts with the GitLab API to create a protected branch in a specified project. It is useful for automating branch protection settings in GitLab projects, such as restricting who can push or merge to certain branches. For example, a user can automate the protection of the 'main' branch in multiple projects to enforce development policies.

Use Case Examples

  1. Automate branch protection for a project by specifying the project ID and branch details.
  2. Integrate with CI/CD pipelines to ensure branches are protected before deployment.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request.
Authentication Type of authentication used, default is GitLab API key.
baseUrl Base URL of the GitLab instance, default is https://gitlab.com.
Method HTTP method to use for the request, default is GET but POST is used for this operation.
Parameter Schema Schema defining the path and body parameters for the request, including project ID and protected branch details.
Request Body Schema Schema for the request body, defining the protected branch details to be created.
Request Path API endpoint path for creating a protected branch in a project.
Path Parameters Collection of path parameters, specifically the project ID or URL-encoded path.

Output

JSON

  • response - The JSON response from the GitLab API after creating the protected branch, containing details of the protected branch.

Dependencies

  • Requires GitLab API key credential for authentication.

Troubleshooting

  • Ensure the project ID is correct and accessible with the provided API key.
  • Verify that the API key has sufficient permissions to create protected branches.
  • Check the baseUrl if using a self-hosted GitLab instance instead of gitlab.com.
  • Common errors include authentication failures, invalid project ID, or insufficient permissions.

Links

Discussion