GitLab Extended icon

GitLab Extended

Extended GitLab node

Overview

This node operation deletes a branch from a GitLab project repository. It is useful when you want to programmatically remove branches that are no longer needed, such as feature branches after merging or stale branches cluttering the repository.

Common scenarios include:

  • Automating cleanup of feature branches after pull requests are merged.
  • Removing outdated or erroneous branches in CI/CD workflows.
  • Managing branches in bulk via automation scripts.

Example: Automatically delete a branch named feature/login from a specific GitLab project once its merge request is completed.

Properties

Name Meaning
Authentication Choose between using saved credentials ("Credential") or specifying custom connection details ("Custom").
GitLab Server Base URL of your GitLab instance (e.g., https://gitlab.com). Used only if "Custom" authentication is selected.
Access Token Personal access token with API permissions for GitLab. Used only if "Custom" authentication is selected.
Project Owner Namespace or owner of the project. Ignored if "Project ID" is set. Used only if "Custom" authentication is selected.
Project Name Project slug or name. Ignored if "Project ID" is set. Used only if "Custom" authentication is selected.
Project ID Numeric project ID. Takes precedence over owner and name if provided. Used only if "Custom" authentication is selected.
Branch The name of the branch to delete, e.g., feature/login. This property is required.

Output

The output is a JSON array containing the response from the GitLab API after attempting to delete the specified branch. Typically, this will be an empty object {} on successful deletion or an error message if the operation fails.

No binary data is output by this operation.

Dependencies

  • Requires access to a GitLab instance, either the public https://gitlab.com or a self-hosted GitLab server.
  • Requires an API access token with sufficient permissions to delete branches in the target project.
  • If using "Credential" authentication, the node expects a configured API key credential in n8n.
  • If using "Custom" authentication, the user must provide the GitLab server URL, access token, and project identification parameters.

Troubleshooting

  • Invalid Project Identification: If neither a valid project ID nor a correct combination of project owner and project name is provided, the node will fail to locate the project. Ensure these fields are correctly set.
  • Insufficient Permissions: Deleting branches requires appropriate API permissions. If the access token lacks these, the API will return an authorization error.
  • Branch Not Found: Attempting to delete a non-existent branch will result in an error. Verify the branch name is correct.
  • API Rate Limits: Frequent calls may hit GitLab API rate limits, causing temporary failures.
  • Network Issues: Connectivity problems to the GitLab server will cause request failures.

Error messages typically come directly from the GitLab API and should be reviewed to adjust input parameters or credentials accordingly.

Links and References

Discussion