GitLab API

GitlabTool

Actions905

Overview

This node operation deletes context commits associated with a specific merge request in a GitLab project. It is useful for managing and cleaning up commits that are part of the context of a merge request, especially when those commits are no longer relevant or need to be removed for clarity or compliance. For example, a developer or DevOps engineer might use this operation to remove certain commits from the merge request context to streamline the review process or correct mistakes.

Use Case Examples

  1. Deleting context commits from a merge request to update the commit history shown in the merge request.
  2. Removing specific commits from the context of a merge request to comply with project policies or cleanup requirements.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the API request (boolean). Defaults to false.
Authentication The authentication method used for the API request, typically an API key credential for GitLab.
baseUrl The base URL of the GitLab instance to which the API request is sent. Defaults to https://gitlab.com.
Method The HTTP method used for the API request. For this operation, it is DELETE.
Query Parameters - Commits The SHA hashes of the context commits to be deleted from the merge request. This is a required array of strings.
Path Parameters - id The ID or URL-encoded path of the GitLab project containing the merge request.
Path Parameters - merge_request_iid The internal ID (IID) of the merge request from which context commits will be deleted.

Output

JSON

  • statusCode - The HTTP status code returned by the API indicating the result of the delete operation.
  • body - The response body from the API, typically containing confirmation or details about the deletion.

Dependencies

  • GitLab API authentication credential

Troubleshooting

  • Ensure that the project ID and merge request IID are correct and exist in the GitLab instance.
  • Verify that the commit SHAs provided in the query parameters are valid and belong to the merge request context.
  • Check that the API authentication credentials have sufficient permissions to delete context commits.
  • Common error messages include 404 Not Found if the project, merge request, or commits do not exist, and 403 Forbidden if the authentication lacks necessary permissions.

Discussion