Actions18
- Branch Actions
- File Actions
- Issue Actions
- Merge Request Actions
- Pipeline Actions
- Raw API Actions
Overview
This node interacts with GitLab repositories to retrieve or list files within a project. Specifically, the File - Get operation fetches the content and metadata of a single file from a GitLab repository at a specified path and reference (branch, tag, or commit SHA). This is useful when you want to programmatically access source code or configuration files stored in GitLab.
Common scenarios:
- Automatically retrieving configuration files for CI/CD pipelines.
- Fetching source code files to analyze or process them in workflows.
- Accessing documentation or scripts stored in a repository without cloning it.
Example:
You want to get the contents of src/index.ts from the main branch of your GitLab project to perform static analysis or trigger further automation based on its content.
Properties
| Name | Meaning |
|---|---|
| File Path | The path to the file in the repository, e.g., src/index.ts. |
| Reference | The Git reference to use, such as a branch name, tag, or commit SHA, e.g., main. |
Output
The node outputs JSON data representing the file's details as returned by the GitLab API. This typically includes:
- File metadata such as encoding, file size, and file path.
- The file content encoded in base64 format.
- The reference used to fetch the file.
If the file content is needed in raw form, the user must decode the base64 content from the output.
The node does not output binary data directly; instead, the file content is embedded in the JSON response.
Dependencies
- Requires an API key credential for authenticating with GitLab.
- Needs configuration of the target GitLab project either by project ID or by owner and project name.
- Uses internal helper functions to make authenticated requests to the GitLab API.
Troubleshooting
- File Not Found Error: If the specified file path or reference does not exist, the GitLab API will return an error. Verify that the file path is correct and that the reference (branch/tag/commit) exists in the repository.
- Authentication Errors: Ensure the API key credential has sufficient permissions to read repository files.
- Encoding Issues: The file content is base64 encoded. If you see unreadable content, decode it properly before use.
- Invalid Parameters: Make sure the "File Path" is provided and non-empty, and the "Reference" is valid.