GitLab API

GitlabTool

Actions1000

Overview

This node operation deletes a file from a GitLab project's repository using the GitLab API. It is useful for automating repository file management tasks such as removing outdated or unnecessary files directly from a CI/CD workflow or integration. For example, a user can delete a specific file from a project branch with a commit message and optionally specify author details for the commit.

Use Case Examples

  1. Deleting a configuration file from a project branch after a feature is deprecated.
  2. Removing a sensitive file accidentally committed to a repository by automating the deletion process.

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, defaulting to GET but can be set to DELETE for this operation.
Query Parameters Parameters sent as query strings in the request URL to specify branch, commit message, start branch, author email, and author name for the commit.
Path Parameters Parameters included in the URL path to identify the project and the file to delete.

Output

JSON

  • id - The project ID or identifier used in the request.
  • file_path - The path of the file deleted from the repository.
  • 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 branch was started, if applicable.
  • author_email - The email of the author who made the commit.
  • author_name - The name of the author who made the commit.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the project ID and file path are correctly URL-encoded and valid.
  • Verify that the branch specified exists and the user has permission to commit to it.
  • Check that the commit message is provided as it is required for the deletion commit.
  • Authentication errors may occur if the API key is missing or invalid; ensure proper credentials are configured.

Links

Discussion