Built-in Module

gitlab

Interact with the GitLab API — post MR comments, update pipelines, manage issues.

Operations

OperationDescription
post_commentPost a general comment on a merge request
post_inline_commentsPost inline line comments on a merge request
get_commit_infoGet commit details
get_user_infoGet user information
get_mr_participantsGet merge request participants
get_files_changedGet list of changed files in MR

Examples

Post AI Review as MR Comment

json
{
  "id": "post_review",
  "type": "gitlab",
  "depends_on": ["ai_review"],
  "config": {
    "operation": "post_comment",
    "body": "{{steps.ai_review.content}}"
  }
}

Post Inline Comments (Text Format)

json
{
  "id": "post_inline_comments",
  "type": "gitlab",
  "depends_on": ["ai_review"],
  "config": {
    "operation": "post_inline_comments",
    "body": "{{steps.ai_review.content}}",
    "output_format": "text",
    "api_type": "discussions",
    "dedup": true
  }
}

AI prompt for text format: Review this code diff and provide comments in format: 'path/to/file.go:42 - issue description'

Post Inline Comments (JSON Format)

json
{
  "id": "post_inline_comments",
  "type": "gitlab",
  "depends_on": ["ai_review"],
  "config": {
    "operation": "post_inline_comments",
    "comments": "{{steps.ai_review.comments}}",
    "output_format": "json",
    "api_type": "discussions",
    "dedup": true
  }
}

AI prompt for JSON format: Return JSON array with file, line, and comment fields

Authentication

Use CI_JOB_TOKEN which is automatically available in GitLab CI:

yaml
variables:
  GITLAB_TOKEN: $CI_JOB_TOKEN