GitLab API icon

GitLab API

Gitlab

Actions917

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 project's 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 repository.

Use Case Examples

  1. Updating a source code file in a GitLab project repository to fix a bug or add a feature.
  2. Modifying a configuration file in a project repository as part of a deployment pipeline.
  3. Automating documentation updates by editing markdown files in the repository.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request (boolean). Useful for public repositories or unauthenticated access.
Authentication The authentication method used 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 for the API request, defaulting to PUT for this operation.
Path Parameters Parameters for the API path including project ID and file path in the repository.

Output

JSON

  • file_path - The path of the updated file in the repository.
  • branch - The branch where the file was updated.
  • commit_id - The commit ID created by the file update.
  • content - The updated content of the file, base64 encoded.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID and file path are correctly URL encoded to avoid 404 errors.
  • Authentication errors may occur if the API key is missing or invalid; verify credentials.
  • Permission errors if the API key does not have write access to the project repository.
  • Check that the branch specified in the request body exists and is correct.

Links

Discussion