GitLab API icon

GitLab API

Gitlab

Actions1062

Projects → patchApiV4ProjectsIdProtectedBranchesName

AI-generated

Summary

Update the protection settings of a specific protected branch within a GitLab project by providing the project ID and branch name, along with the desired patch details.

Inputs

  • id (required) — The ID or URL-encoded path of the GitLab project containing the protected branch.
  • name (required) — The name of the protected branch to update.
  • patchApiV4ProjectsIdProtectedBranchesName (required) — The request body containing the patch details to modify the protected branch's settings.
  • Skip Authentication — Optionally skip using configured authentication (default false).
  • baseUrl — The base URL of the GitLab instance; defaults to https://gitlab.com.

Output shape

a JSON object representing the updated protected branch's information

The operation PATCHes to the endpoint /api/v4/projects/{id}/protected_branches/{name}. Requires the 'id' and 'name' parameters, and a request body matching the patchApiV4ProjectsIdProtectedBranchesName schema. Returns the updated protected branch details.

Examples

Example 1: Update the access levels of a protected branch named 'main' in project 'mygroup/myproject' to restrict who can push or merge.

Set 'id' to 'mygroup/myproject', 'name' to 'main', and provide 'patchApiV4ProjectsIdProtectedBranchesName' with the desired access level updates in the request body.

Links

Discussion