Actions11
Overview
This node interacts with GitLab repositories to list files within a project repository. Specifically, the File - List operation retrieves a list of files and directories from a specified path in a GitLab repository at a given reference (branch, tag, or commit). This is useful for workflows that need to explore repository contents, automate file processing, or integrate repository data into other systems.
Common scenarios:
- Automatically fetching directory contents to trigger further processing on listed files.
- Auditing or reporting repository structure changes.
- Integrating GitLab repository file listings into documentation or deployment pipelines.
Example:
You want to get all files under the src folder of your project’s main branch to analyze or copy them elsewhere. Using this node, you specify the project owner, repository name, the path src, and the reference main. The node returns the list of files and folders under that path.
Properties
| Name | Meaning |
|---|---|
| Authentication | Method used to authenticate with GitLab API. Options: "Access Token" or "OAuth2". |
| Project Owner | The username or group name that owns the GitLab project. |
| Project Name | The repository name within the project owner’s namespace. |
| File Path | The path inside the repository to list files from (e.g., src/). |
| Reference | The Git reference to use (branch name, tag, or commit SHA). Defaults to main. |
| Return All | Whether to return all results or limit the number of returned items. |
| Limit | Maximum number of results to return if "Return All" is false. Minimum value is 1. |
Output
The node outputs an array of JSON objects representing files and directories found at the specified path and reference. Each object typically contains metadata about each file or folder such as:
id: Unique identifier of the file or folder.name: Name of the file or folder.type: Type indicator (blobfor file,treefor directory).path: Full path relative to the repository root.mode: File mode or permissions.
If binary data were involved (e.g., file content), it would be included in a separate binary property, but this operation only lists file metadata without returning file contents.
Dependencies
- Requires access to the GitLab API via either an access token or OAuth2 authentication.
- The node expects valid credentials configured in n8n for authenticating requests.
- No additional external dependencies beyond standard HTTP requests to GitLab API.
Troubleshooting
- Invalid project owner or repository name: Ensure the owner and repository names are correct and URL-encoded properly. Incorrect values will cause 404 errors.
- Insufficient permissions: The provided authentication token must have read access to the repository; otherwise, the API will return authorization errors.
- Reference not found: If the specified reference (branch/tag/commit) does not exist, the API will return an error.
- Rate limiting: GitLab API enforces rate limits; excessive requests may result in temporary blocking.
- Empty results: If the path does not exist or contains no files, the output will be empty.
To resolve errors, verify credentials, project details, and references. Check GitLab API documentation for permission scopes required.
Links and References
- GitLab Repository Tree API – Official GitLab API docs for listing repository files and directories.
- GitLab Authentication – Details on access tokens and OAuth2 usage with GitLab API.