GitLab API

GitlabTool

Actions1000

Overview

This node operation allows updating a protected branch of a specific project in GitLab 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 project identified by its ID or URL-encoded path.

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 enforce stricter access control.

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 to which the API request is sent.
Method The HTTP method used for the API request, default is GET but PATCH is relevant here.
Path Parameters Parameters used in the API request path to identify the project and branch to update.

Output

JSON

  • id - The ID of the protected branch updated.
  • 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 to the branch.
  • unprotect_access_levels - Access levels allowed to unprotect the branch.

Dependencies

  • GitLab API authentication credential

Troubleshooting

  • Ensure the project ID or URL-encoded path and branch name are correct to avoid 404 errors.
  • Verify that the authentication credentials are valid and have sufficient permissions to update protected branches.
  • Check that the request body schema matches the expected structure for updating protected branches to prevent validation errors.

Links

Discussion