GitLab API

GitlabTool

Actions905

Overview

This node operation updates a file in a GitLab project's repository using the GitLab API. It is useful for automating file modifications in a repository, such as updating configuration files, code files, or documentation directly from an n8n workflow. For example, it can be used to programmatically update a README file or configuration script in a GitLab project.

Use Case Examples

  1. Updating a source code file in a GitLab repository to fix a bug or add a feature.
  2. Modifying a configuration file in a project repository as part of a deployment pipeline.

Properties

Name Meaning
Skip Authentication If set to true, the node will skip using authentication for the API request.
Authentication The authentication method to use for the API request, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method to use for the API request, defaulting to GET but can be set to PUT for this operation.
Path Parameters Parameters for the API path including the project ID and the URL-encoded file path to update.

Output

JSON

  • id - The project ID used in the request path.
  • file_path - The file path in the repository that was updated.
  • commit_id - The commit ID resulting from the file update operation.
  • branch - The branch in the repository where the file was updated.
  • message - The commit message associated with the file update.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID and file path are correctly URL-encoded and valid in the GitLab repository.
  • Verify that the API key used has sufficient permissions to update files in the target project repository.
  • Check that the HTTP method is set to PUT for updating files, as other methods may not work for this operation.
  • Common errors include authentication failures, file not found errors, or permission denied errors. Verify credentials and repository access rights to resolve these.

Links

Discussion