GitLab API

GitlabTool

Actions1000

Overview

This node operation allows updating a file in a GitLab project's repository by specifying the project ID and the file path. It is useful for automating file modifications within a GitLab repository, such as updating configuration files, code files, or documentation directly through n8n workflows.

Use Case Examples

  1. Updating a README file in a GitLab project repository to include new instructions.
  2. Modifying a configuration file in a project repository as part of a CI/CD pipeline automation.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public repositories or when authentication is handled externally.
Authentication Select the authentication method to use, defaulting to GitLab API authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method HTTP method to use for the request, defaulting to GET but can be set to PUT for this operation.
Path Parameters Parameters to specify the project ID and the URL-encoded file path in the repository.

Output

JSON

  • file_path - The path of the file updated in the repository.
  • branch - The branch where the file update is applied.
  • commit_id - The commit ID generated by the file update.
  • content - The updated content of the file.
  • encoding - The encoding format of the file content.

Dependencies

  • GitLab API authentication token

Troubleshooting

  • Ensure the project ID and file path are correctly URL-encoded and valid.
  • Verify that the authentication token has sufficient permissions to update repository files.
  • Check that the HTTP method is set to PUT for updating files.
  • Common errors include 404 Not Found if the project or file does not exist, and 401 Unauthorized if authentication fails.

Links

Discussion