GitLab API icon

GitLab API

Gitlab

Actions880

Overview

This node operation allows updating a protected branch in a GitLab project via the GitLab API. It is useful for managing branch protection settings programmatically, such as changing permissions or branch rules. For example, a user can update the protection settings of the 'main' branch in a specific project by specifying the project ID or URL-encoded path and the branch name.

Use Case Examples

  1. Update the protection settings of the 'main' branch in the 'gitlab-org/gitlab' project to restrict who can push or merge.
  2. Modify branch protection rules for a project branch to automate repository management workflows.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
Authentication The authentication method used for the API request, typically a GitLab API key.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method to use for the request, default is GET but PATCH is relevant here.
Path Parameters Parameters for the API path including the project ID or URL-encoded path and the branch name to update.

Output

JSON

  • id - The ID or URL-encoded path of the project.
  • name - The name of the branch being updated.
  • patchApiV4ProjectsIdProtectedBranchesName - The request body schema containing the update details for the protected branch.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID or URL-encoded path and branch name are correctly specified to avoid 404 errors.
  • Verify that the API key has sufficient permissions to update protected branches to prevent authorization errors.
  • Check the request body schema for required fields to avoid validation errors from the API.

Links

Discussion