Skip to content

Script Attributes

The Expr Language Definition is a great resource to learn more about the language

Note

Missing an attribute? The schema/gitlab.schema.graphqls file are what is used to query GitLab, adding the missing field to the right type should make it accessible. Please open an issue or Pull Request if something is missing.

The following attributes are available in script fields.

They can be accessed exactly as shown in this list.

project

The project the Merge Request belongs to

  • project.archived ; boolean. Indicates the archived status of the project
  • project.created_at ; time. Timestamp of the project creation
  • project.description ; string. Short description of the project
  • project.full_path ; string. Full path of the project
  • project.id ; string. ID of the project
  • project.issues_enabled ; boolean. Indicates if Issues are enabled for the current user
  • project.last_activity_at ; time. Timestamp of the project last activity
  • project.name ; string. Name of the project (without namespace)
  • project.name_with_namespace ; string. Full name of the project with its namespace
  • project.path ; string. Path of the project
  • project.topics ; []string. List of project topics
  • project.visibility ; string. Visibility of the project

project.labels[]

Labels available on this project

  • project.labels[].color ; string. Background color of the label
  • project.labels[].description ; string. Description of the label (Markdown rendered as HTML for caching)
  • project.labels[].id ; string. Label ID
  • project.labels[].title ; string. Content of the label

group

The project group

  • group.description ; string. Description of the namespace
  • group.emails_disabled ; optional boolean. Indicates if a group has email notifications disabled
  • group.full_name ; string. Full name of the namespace
  • group.full_path ; string. Full path of the namespace
  • group.id ; string. ID of the namespace
  • group.mentions_disabled ; optional boolean. Indicates if a group is disabled from getting mentioned
  • group.name ; string. Name of the namespace
  • group.path ; string. Path of the namespace
  • group.visibility ; optional string. Visibility of the namespace
  • group.web_url ; string. Web URL of the group

merge_request

Information about the Merge Request

  • merge_request.approvals_left ; optional int. Number of approvals left
  • merge_request.approvals_required ; optional int. Number of approvals required
  • merge_request.approved ; boolean. Indicates if the merge request has all the required approvals
  • merge_request.auto_merge_enabled ; boolean. Indicates if auto merge is enabled for the merge request
  • merge_request.auto_merge_strategy ; optional string. Selected auto merge strategy
  • merge_request.commit_count ; optional int. Number of commits in the merge request
  • merge_request.conflicts ; boolean. Indicates if the merge request has conflicts
  • merge_request.created_at ; time. Timestamp of when the merge request was created
  • merge_request.description ; optional string. Description of the merge request (Markdown rendered as HTML for caching)
  • merge_request.detailed_merge_status (optional enum) Detailed merge status of the merge request

    The following values are valid:

    • UNCHECKED Merge status has not been checked
    • CHECKING Currently checking for mergeability
    • MERGEABLE Branch can be merged
    • COMMITS_STATUS Source branch exists and contains commits
    • CI_MUST_PASS Pipeline must succeed before merging
    • CI_STILL_RUNNING Pipeline is still running
    • DISCUSSIONS_NOT_RESOLVED Discussions must be resolved before merging
    • DRAFT_STATUS Merge request must not be draft before merging
    • NOT_OPEN Merge request must be open before merging
    • NOT_APPROVED Merge request must be approved before merging
    • BLOCKED_STATUS Merge request dependencies must be merged
    • EXTERNAL_STATUS_CHECKS Status checks must pass
    • PREPARING Merge request diff is being created
    • JIRA_ASSOCIATION Either the title or description must reference a Jira issue
    • CONFLICT There are conflicts between the source and target branches
    • NEED_REBASE Merge request needs to be rebased
    • REQUESTED_CHANGES Indicates a reviewer has requested change
  • merge_request.discussion_locked ; boolean. Indicates if comments on the merge request are locked to members only

  • merge_request.diverged_from_target_branch ; boolean. Indicates if the source branch is behind the target branch
  • merge_request.downvotes ; int. Number of downvotes for the merge request
  • merge_request.draft ; boolean. Indicates if the merge request is a draft
  • merge_request.force_remove_source_branch ; optional boolean. Indicates if the project settings will lead to source branch deletion after merge
  • merge_request.id ; string. ID of the merge request
  • merge_request.iid ; string. Internal ID of the merge request
  • merge_request.merge_status_enum (optional enum) Merge status of the merge request

    The following values are valid:

    • UNCHECKED Merge status has not been checked
    • CHECKING Currently checking for mergeability
    • CAN_BE_MERGED There are no conflicts between the source and target branches
    • CANNOT_BE_MERGED There are conflicts between the source and target branches
    • CANNOT_BE_MERGED_RECHECK Currently unchecked. The previous state was CANNOT_BE_MERGED
  • merge_request.merge_when_pipeline_succeeds ; optional boolean. Indicates if the merge has been set to auto-merge

  • merge_request.mergeable ; boolean. Indicates if the merge request is mergeable
  • merge_request.mergeable_discussions_state ; optional boolean. Indicates if all discussions in the merge request have been resolved, allowing the merge request to be merged
  • merge_request.merged_at ; optional time. Timestamp of when the merge request was merged, null if not merged
  • merge_request.prepared_at ; optional time. Timestamp of when the merge request was prepared
  • merge_request.should_be_rebased ; boolean. Indicates if the merge request will be rebased
  • merge_request.should_remove_source_branch ; optional boolean. Indicates if the source branch of the merge request will be deleted after merge
  • merge_request.source_branch ; string. Source branch of the merge request
  • merge_request.source_branch_exists ; boolean. Indicates if the source branch of the merge request exists
  • merge_request.source_branch_protected ; boolean. Indicates if the source branch is protected
  • merge_request.squash ; boolean. Indicates if the merge request is set to be squashed when merged. Project settings may override this value. Use squash_on_merge instead to take project squash options into account
  • merge_request.squash_on_merge ; boolean. Indicates if the merge request will be squashed when merged
  • merge_request.state ; string. State of the merge request
  • merge_request.target_branch ; string. Target branch of the merge request
  • merge_request.target_branch_exists ; boolean. Indicates if the target branch of the merge request exists
  • merge_request.time_between_first_and_last_commit ; optional duration. Duration between first and last commit made
  • merge_request.time_since_first_commit ; optional duration. Duration (from 'now') since the first commit was made
  • merge_request.time_since_last_commit ; optional duration. Duration (from 'now') since the last commit was made
  • merge_request.title ; string. Title of the merge request
  • merge_request.updated_at ; time. Timestamp of when the merge request was last updated
  • merge_request.upvotes ; int. Number of upvotes for the merge request.
  • merge_request.user_discussions_count ; optional int. Number of user discussions in the merge request
  • merge_request.user_notes_count ; optional int. User notes count of the merge request

merge_request.diff_stats[]

Changes to a single file

  • merge_request.diff_stats[].additions ; int. Number of lines added to this file
  • merge_request.diff_stats[].deletions ; int. Number of lines deleted from this file
  • merge_request.diff_stats[].path ; string. File path, relative to repository root

merge_request.labels[]

Labels available on this merge request

  • merge_request.labels[].color ; string. Background color of the label
  • merge_request.labels[].description ; string. Description of the label (Markdown rendered as HTML for caching)
  • merge_request.labels[].id ; string. Label ID
  • merge_request.labels[].title ; string. Content of the label

merge_request.head_pipeline

Pipeline running on the branch HEAD of the merge request

  • merge_request.head_pipeline.active ; boolean. Indicates if the pipeline is active
  • merge_request.head_pipeline.cancelable ; boolean. Specifies if a pipeline can be canceled
  • merge_request.head_pipeline.complete ; boolean. Indicates if a pipeline is complete
  • merge_request.head_pipeline.duration ; optional int. Duration of the pipeline in seconds
  • merge_request.head_pipeline.failure_reason ; optional string. The reason why the pipeline failed
  • merge_request.head_pipeline.finished_at ; optional time. Timestamp of the pipeline's completion
  • merge_request.head_pipeline.id ; string. ID of the pipeline
  • merge_request.head_pipeline.iid ; string. Internal ID of the pipeline
  • merge_request.head_pipeline.latest ; boolean. If the pipeline is the latest one or not
  • merge_request.head_pipeline.name ; optional string. Name of the pipeline
  • merge_request.head_pipeline.path ; optional string. Relative path to the pipeline's page
  • merge_request.head_pipeline.retryable ; boolean. Specifies if a pipeline can be retried
  • merge_request.head_pipeline.started_at ; optional time. Timestamp when the pipeline was started
  • merge_request.head_pipeline.status (enum) Status of the pipeline

    The following values are valid:

    • CANCELED
    • CANCELING
    • CREATED
    • FAILED
    • MANUAL
    • PENDING
    • PREPARING
    • RUNNING
    • SCHEDULED
    • SKIPPED
    • SUCCESS
    • WAITING_FOR_CALLBACK
    • WAITING_FOR_RESOURCE
  • merge_request.head_pipeline.stuck ; boolean. If the pipeline is stuck

  • merge_request.head_pipeline.total_jobs ; int. The total number of jobs in the pipeline
  • merge_request.head_pipeline.updated_at ; time. Timestamp of the pipeline's last activity
  • merge_request.head_pipeline.warnings ; boolean. Indicates if a pipeline has warnings

merge_request.notes[]

All notes on this MR

  • merge_request.notes[].body ; string. Content of the note
  • merge_request.notes[].created_at ; time. Timestamp of the note creation
  • merge_request.notes[].updated_at ; time. Timestamp of the note’s last activity

merge_request.notes[].author

User who wrote the note

  • merge_request.notes[].author.bot ; boolean. Indicates if the user is a bot
  • merge_request.notes[].author.public_email ; optional string. User’s public email
  • merge_request.notes[].author.state (enum) State of the user

    The following values are valid:

    • active User is active and can use the system
    • blocked User has been blocked by an administrator and cannot use the system
    • deactivated User is no longer active and cannot use the system
    • banned User is blocked, and their contributions are hidden
    • ldap_blocked User has been blocked by the system
    • blocked_pending_approval User is blocked and pending approval
  • merge_request.notes[].author.username ; string. Username of the user. Unique within this instance of GitLab

merge_request.first_commit

Information about the first commit made

  • merge_request.first_commit.author_email ; optional string. Commit author’s email
  • merge_request.first_commit.author_name ; optional string. Commit authors name
  • merge_request.first_commit.authored_date ; optional time. Timestamp of when the commit was authored
  • merge_request.first_commit.committed_date ; optional time. Timestamp of when the commit was committed
  • merge_request.first_commit.committer_email ; optional string. Email of the committer
  • merge_request.first_commit.committer_name ; optional string. Name of the committer
  • merge_request.first_commit.description ; optional string. Description of the commit message
  • merge_request.first_commit.full_title ; optional string. Full title of the commit message
  • merge_request.first_commit.id ; optional string. ID (global ID) of the commit
  • merge_request.first_commit.message ; optional string. Raw commit message
  • merge_request.first_commit.sha ; string. SHA1 ID of the commit
  • merge_request.first_commit.short_id ; string. Short SHA1 ID of the commit
  • merge_request.first_commit.title ; optional string. Title of the commit message
  • merge_request.first_commit.web_url ; string. Web URL of the commit

merge_request.first_commit.author

Author of the commit

  • merge_request.first_commit.author.bot ; boolean. Indicates if the user is a bot
  • merge_request.first_commit.author.public_email ; optional string. User’s public email
  • merge_request.first_commit.author.state (enum) State of the user

    The following values are valid:

    • active User is active and can use the system
    • blocked User has been blocked by an administrator and cannot use the system
    • deactivated User is no longer active and cannot use the system
    • banned User is blocked, and their contributions are hidden
    • ldap_blocked User has been blocked by the system
    • blocked_pending_approval User is blocked and pending approval
  • merge_request.first_commit.author.username ; string. Username of the user. Unique within this instance of GitLab

merge_request.last_commit

Information about the last commit made

  • merge_request.last_commit.author_email ; optional string. Commit author’s email
  • merge_request.last_commit.author_name ; optional string. Commit authors name
  • merge_request.last_commit.authored_date ; optional time. Timestamp of when the commit was authored
  • merge_request.last_commit.committed_date ; optional time. Timestamp of when the commit was committed
  • merge_request.last_commit.committer_email ; optional string. Email of the committer
  • merge_request.last_commit.committer_name ; optional string. Name of the committer
  • merge_request.last_commit.description ; optional string. Description of the commit message
  • merge_request.last_commit.full_title ; optional string. Full title of the commit message
  • merge_request.last_commit.id ; optional string. ID (global ID) of the commit
  • merge_request.last_commit.message ; optional string. Raw commit message
  • merge_request.last_commit.sha ; string. SHA1 ID of the commit
  • merge_request.last_commit.short_id ; string. Short SHA1 ID of the commit
  • merge_request.last_commit.title ; optional string. Title of the commit message
  • merge_request.last_commit.web_url ; string. Web URL of the commit

merge_request.last_commit.author

Author of the commit

  • merge_request.last_commit.author.bot ; boolean. Indicates if the user is a bot
  • merge_request.last_commit.author.public_email ; optional string. User’s public email
  • merge_request.last_commit.author.state (enum) State of the user

    The following values are valid:

    • active User is active and can use the system
    • blocked User has been blocked by an administrator and cannot use the system
    • deactivated User is no longer active and cannot use the system
    • banned User is blocked, and their contributions are hidden
    • ldap_blocked User has been blocked by the system
    • blocked_pending_approval User is blocked and pending approval
  • merge_request.last_commit.author.username ; string. Username of the user. Unique within this instance of GitLab

merge_request.author

User who created this merge request

  • merge_request.author.bot ; boolean. Indicates if the user is a bot
  • merge_request.author.public_email ; optional string. User’s public email
  • merge_request.author.state (enum) State of the user

    The following values are valid:

    • active User is active and can use the system
    • blocked User has been blocked by an administrator and cannot use the system
    • deactivated User is no longer active and cannot use the system
    • banned User is blocked, and their contributions are hidden
    • ldap_blocked User has been blocked by the system
    • blocked_pending_approval User is blocked and pending approval
  • merge_request.author.username ; string. Username of the user. Unique within this instance of GitLab

current_user

Get information about current user

  • current_user.bot ; boolean. Indicates if the user is a bot
  • current_user.public_email ; optional string. User’s public email
  • current_user.state (enum) State of the user

    The following values are valid:

    • active User is active and can use the system
    • blocked User has been blocked by an administrator and cannot use the system
    • deactivated User is no longer active and cannot use the system
    • banned User is blocked, and their contributions are hidden
    • ldap_blocked User has been blocked by the system
    • blocked_pending_approval User is blocked and pending approval
  • current_user.username ; string. Username of the user. Unique within this instance of GitLab

webhook_event

webhook_event attribute is only available in server mode

You have access to the raw webhook event payload via webhook_event.* attributes (not listed below) in Expr script fields when using server mode.

See the GitLab Webhook Events documentation for available fields.

The attributes are named exactly as documented in the GitLab documentation.

  • Comments - A comment is made or edited on an issue or merge request.
  • Merge request events - A merge request is created, updated, or merged.