GitLab API

GitlabTool

Actions905

Overview

This node operation deletes a file from a GitLab project repository using the GitLab API. It is useful for automating repository management tasks such as removing outdated or unnecessary files programmatically. For example, it can be used in CI/CD pipelines to clean up files after deployment or in project maintenance workflows to delete deprecated scripts or documents.

Use Case Examples

  1. Deleting a configuration file from a specific branch in a GitLab project.
  2. Removing a deprecated script file from the main branch with a commit message explaining the deletion.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request.
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 to use for the request, default is DELETE for this operation.
Query Parameters Parameters sent as query strings in the API request to specify branch, commit message, start branch, author email, and author name.
Path Parameters Parameters included in the URL path to specify the project ID and the file path to delete.

Output

JSON

  • id - The project ID or path used in the request.
  • file_path - The URL encoded path of the file deleted.
  • branch - The branch where the file was deleted.
  • commit_message - The commit message associated with the file deletion.
  • start_branch - The branch from which the new commit started, if applicable.
  • author_email - Email of the author who made the commit.
  • author_name - Name of the author who made the commit.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID and file path are correctly URL encoded to avoid 404 errors.
  • Verify that the branch specified exists and that the user has permission to commit to it to prevent authorization errors.
  • Check that the commit message is provided as it is required by the API for the delete operation.
  • If skipping authentication, ensure the GitLab instance allows unauthenticated requests, otherwise the request will fail.

Links

Discussion