Actions11
Overview
This node interacts with GitLab to manage branches within a project repository. Specifically, the Get Branch operation retrieves detailed information about a single branch in a specified GitLab project. This is useful when you want to programmatically check the status, commit details, or metadata of a particular branch.
Common scenarios:
- Automating deployment pipelines by verifying if a branch exists and retrieving its latest commit.
- Monitoring branch protection or merge request readiness.
- Integrating branch data into dashboards or reports.
Example:
You want to fetch details about the develop branch of your project owned by my-org named my-repo. Using this node, you provide the owner, repository name, and branch name (develop) to get branch metadata such as commit SHA, merged status, and protection rules.
Properties
| Name | Meaning |
|---|---|
| Authentication | Method to authenticate with GitLab API. Options: Access Token, OAuth2 |
| Project Owner | The username or group name that owns the GitLab project |
| Project Name | The repository name within the owner's projects |
| Branch Name | The exact name of the branch to retrieve (e.g., main, feature-xyz) |
Output
The output is a JSON object representing the branch details returned from GitLab's API for the specified branch. It typically includes fields such as:
name: Branch namecommit: Object containing commit details like SHA, author, message, etc.merged: Boolean indicating if the branch has been mergedprotected: Boolean indicating if the branch is protected- Other metadata related to the branch state and permissions
The node outputs an array of such JSON objects (usually one item per execution since it gets a single branch).
No binary data is produced by this operation.
Dependencies
- Requires access to a GitLab instance via its REST API.
- Needs an API authentication credential configured in n8n, either:
- An API access token with appropriate permissions, or
- OAuth2 credentials authorized for the GitLab project.
- Network connectivity to GitLab server.
Troubleshooting
Common issues:
- Incorrect project owner or repository name causing "404 Not Found" errors.
- Branch name typo leading to "Branch not found" responses.
- Insufficient permissions on the API token resulting in authorization errors.
- URL encoding issues if owner or repo names contain special characters (the node encodes slashes
%2F).
Error messages:
"Unknown resource: branch": Indicates the resource parameter was set incorrectly; ensure "Branch" is selected.- HTTP 401/403 errors: Check API credentials and their scopes.
- HTTP 404 errors: Verify the project owner, repository, and branch name are correct and exist.