GitLab Extended icon

GitLab Extended

Extended GitLab node

Overview

This node operation allows you to post a discussion note on a GitLab merge request. It is useful for adding comments or feedback directly within the context of a merge request's code review discussions. You can either start a new discussion thread or reply to an existing one, optionally specifying detailed position information such as file paths and line numbers to pinpoint exactly where your comment applies.

Practical examples include:

  • Adding a general comment to a merge request to provide overall feedback.
  • Replying to an existing discussion thread to continue a conversation about specific code changes.
  • Commenting inline on specific lines or ranges of code in the merge request diff to highlight issues or suggest improvements.

Properties

Name Meaning
Authentication Choose whether to use saved credentials ("Credential") or specify custom connection details ("Custom").
GitLab Server Base URL of your GitLab instance (e.g., "https://gitlab.com"). Used only if "Custom" authentication is selected.
Access Token Personal access token with API permissions. Used only if "Custom" authentication is selected.
Project Owner Namespace or owner of the project. Ignored if "Project ID" is set. Used only if "Custom" authentication is selected.
Project Name Project slug or name. Ignored if "Project ID" is set. Used only if "Custom" authentication is selected.
Project ID Numeric project ID. Takes precedence over owner and name if provided. Used only if "Custom" authentication is selected.
Merge Request IID The internal ID number of the merge request to which the discussion note will be posted. Must be a positive integer.
Body The text content of the note, e.g., "Looks good to me". Optional but typically used to provide the comment text.
Start New Discussion Boolean flag indicating whether to start a new discussion thread (true) or reply to an existing one (false). Defaults to false.
Discussion ID The ID of the existing discussion to reply to. Required if replying to an existing discussion (i.e., when "Start New Discussion" is false).
Position Type Specifies the type of position for the note: "Text" or "Image". Defaults to "text".
New Path File path to the new version of the file where the note applies. Optional.
Old Path File path to the old version of the file where the note applies. Optional.
New Line Line number in the new file version where the note applies. Optional.
Old Line Line number in the old file version where the note applies. Optional.
Line Range Start Line Code Line code identifying the start of a multiline note range. Optional.
Line Range Start Type Whether the start line is from the "new" or "old" version of the file. Defaults to "new".
Line Range Start Old Line Old line number of the start line in a multiline note range. Optional.
Line Range Start New Line New line number of the start line in a multiline note range. Optional.
Line Range End Line Code Line code identifying the end of a multiline note range. Optional.
Line Range End Type Whether the end line is from the "new" or "old" version of the file. Defaults to "new".
Line Range End Old Line Old line number of the end line in a multiline note range. Optional.
Line Range End New Line New line number of the end line in a multiline note range. Optional.
Base SHA Base commit SHA related to the merge request. Optional.
Head SHA Head commit SHA related to the merge request. Optional.
Start SHA Start commit SHA related to the merge request. Optional.
Commit ID SHA referencing the commit to start this discussion thread on. Optional.
Created At ISO 8601 date-time string specifying when the note was created. Optional.

Output

The output is a JSON object representing the newly created discussion note as returned by the GitLab API. This includes all standard fields of a discussion note such as its ID, body text, author information, timestamps, and position details if specified.

If the note is attached to a specific position in the code diff, the output will include detailed position metadata describing the file paths, line numbers, and commit SHAs relevant to the note.

No binary data output is produced by this operation.

Dependencies

  • Requires access to a GitLab instance via its REST API.
  • Requires an API access token with appropriate permissions to read and write merge request discussions.
  • Supports two authentication modes:
    • Using saved credentials configured in n8n.
    • Providing custom connection details including server URL and personal access token.
  • No additional external dependencies beyond the GitLab API and n8n environment.

Troubleshooting

  • Invalid or missing Merge Request IID: Ensure the merge request IID is a positive integer and corresponds to an existing merge request in the target project.
  • Authentication errors: Verify that the access token has sufficient permissions to post notes on merge requests. If using custom authentication, confirm the server URL and token are correct.
  • Discussion ID required when replying: When not starting a new discussion, the "Discussion ID" must be provided and valid.
  • Position parameters mismatch: If specifying position details (file paths, line numbers), ensure they correspond correctly to the merge request diff; otherwise, the API may reject the note.
  • Malformed JSON in optional fields: Although not typical for this operation, if any JSON input is used elsewhere, ensure it is well-formed.
  • API rate limits or network issues: Check connectivity and GitLab API rate limits if requests fail unexpectedly.

Links and References

Discussion