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 projectproject.created_at
;time
. Timestamp of the project creationproject.description
;string
. Short description of the projectproject.full_path
;string
. Full path of the projectproject.id
;string
. ID of the projectproject.issues_enabled
;boolean
. Indicates if Issues are enabled for the current userproject.last_activity_at
;time
. Timestamp of the project last activityproject.name
;string
. Name of the project (without namespace)project.name_with_namespace
;string
. Full name of the project with its namespaceproject.path
;string
. Path of the projectproject.topics
;[]string
. List of project topicsproject.visibility
;string
. Visibility of the project
project.labels[]
¶
Labels available on this project
project.labels[].color
;string
. Background color of the labelproject.labels[].description
;string
. Description of the label (Markdown rendered as HTML for caching)project.labels[].id
;string
. Label IDproject.labels[].title
;string
. Content of the label
group
¶
The project group
group.description
;string
. Description of the namespacegroup.emails_disabled
;optional boolean
. Indicates if a group has email notifications disabledgroup.full_name
;string
. Full name of the namespacegroup.full_path
;string
. Full path of the namespacegroup.id
;string
. ID of the namespacegroup.mentions_disabled
;optional boolean
. Indicates if a group is disabled from getting mentionedgroup.name
;string
. Name of the namespacegroup.path
;string
. Path of the namespacegroup.visibility
;optional string
. Visibility of the namespacegroup.web_url
;string
. Web URL of the group
merge_request
¶
Information about the Merge Request
merge_request.approvals_left
;optional int
. Number of approvals leftmerge_request.approvals_required
;optional int
. Number of approvals requiredmerge_request.approved
;boolean
. Indicates if the merge request has all the required approvalsmerge_request.auto_merge_enabled
;boolean
. Indicates if auto merge is enabled for the merge requestmerge_request.auto_merge_strategy
;optional string
. Selected auto merge strategymerge_request.commit_count
;optional int
. Number of commits in the merge requestmerge_request.conflicts
;boolean
. Indicates if the merge request has conflictsmerge_request.created_at
;time
. Timestamp of when the merge request was createdmerge_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 requestThe following values are valid:
UNCHECKED
Merge status has not been checkedCHECKING
Currently checking for mergeabilityMERGEABLE
Branch can be mergedCOMMITS_STATUS
Source branch exists and contains commitsCI_MUST_PASS
Pipeline must succeed before mergingCI_STILL_RUNNING
Pipeline is still runningDISCUSSIONS_NOT_RESOLVED
Discussions must be resolved before mergingDRAFT_STATUS
Merge request must not be draft before mergingNOT_OPEN
Merge request must be open before mergingNOT_APPROVED
Merge request must be approved before mergingBLOCKED_STATUS
Merge request dependencies must be mergedEXTERNAL_STATUS_CHECKS
Status checks must passPREPARING
Merge request diff is being createdJIRA_ASSOCIATION
Either the title or description must reference a Jira issueCONFLICT
There are conflicts between the source and target branchesNEED_REBASE
Merge request needs to be rebasedREQUESTED_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 branchmerge_request.downvotes
;int
. Number of downvotes for the merge requestmerge_request.draft
;boolean
. Indicates if the merge request is a draftmerge_request.force_remove_source_branch
;optional boolean
. Indicates if the project settings will lead to source branch deletion after mergemerge_request.id
;string
. ID of the merge requestmerge_request.iid
;string
. Internal ID of the merge request-
merge_request.merge_status_enum
(optional enum) Merge status of the merge requestThe following values are valid:
UNCHECKED
Merge status has not been checkedCHECKING
Currently checking for mergeabilityCAN_BE_MERGED
There are no conflicts between the source and target branchesCANNOT_BE_MERGED
There are conflicts between the source and target branchesCANNOT_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 mergeablemerge_request.mergeable_discussions_state
;optional boolean
. Indicates if all discussions in the merge request have been resolved, allowing the merge request to be mergedmerge_request.merged_at
;optional time
. Timestamp of when the merge request was merged, null if not mergedmerge_request.prepared_at
;optional time
. Timestamp of when the merge request was preparedmerge_request.should_be_rebased
;boolean
. Indicates if the merge request will be rebasedmerge_request.should_remove_source_branch
;optional boolean
. Indicates if the source branch of the merge request will be deleted after mergemerge_request.source_branch
;string
. Source branch of the merge requestmerge_request.source_branch_exists
;boolean
. Indicates if the source branch of the merge request existsmerge_request.source_branch_protected
;boolean
. Indicates if the source branch is protectedmerge_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 accountmerge_request.squash_on_merge
;boolean
. Indicates if the merge request will be squashed when mergedmerge_request.state
;string
. State of the merge requestmerge_request.target_branch
;string
. Target branch of the merge requestmerge_request.target_branch_exists
;boolean
. Indicates if the target branch of the merge request existsmerge_request.time_between_first_and_last_commit
;optional duration
. Duration between first and last commit mademerge_request.time_since_first_commit
;optional duration
. Duration (from 'now') since the first commit was mademerge_request.time_since_last_commit
;optional duration
. Duration (from 'now') since the last commit was mademerge_request.title
;string
. Title of the merge requestmerge_request.updated_at
;time
. Timestamp of when the merge request was last updatedmerge_request.upvotes
;int
. Number of upvotes for the merge request.merge_request.user_discussions_count
;optional int
. Number of user discussions in the merge requestmerge_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 filemerge_request.diff_stats[].deletions
;int
. Number of lines deleted from this filemerge_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 labelmerge_request.labels[].description
;string
. Description of the label (Markdown rendered as HTML for caching)merge_request.labels[].id
;string
. Label IDmerge_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 activemerge_request.head_pipeline.cancelable
;boolean
. Specifies if a pipeline can be canceledmerge_request.head_pipeline.complete
;boolean
. Indicates if a pipeline is completemerge_request.head_pipeline.duration
;optional int
. Duration of the pipeline in secondsmerge_request.head_pipeline.failure_reason
;optional string
. The reason why the pipeline failedmerge_request.head_pipeline.finished_at
;optional time
. Timestamp of the pipeline's completionmerge_request.head_pipeline.id
;string
. ID of the pipelinemerge_request.head_pipeline.iid
;string
. Internal ID of the pipelinemerge_request.head_pipeline.latest
;boolean
. If the pipeline is the latest one or notmerge_request.head_pipeline.name
;optional string
. Name of the pipelinemerge_request.head_pipeline.path
;optional string
. Relative path to the pipeline's pagemerge_request.head_pipeline.retryable
;boolean
. Specifies if a pipeline can be retriedmerge_request.head_pipeline.started_at
;optional time
. Timestamp when the pipeline was started-
merge_request.head_pipeline.status
(enum) Status of the pipelineThe 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 pipelinemerge_request.head_pipeline.updated_at
;time
. Timestamp of the pipeline's last activitymerge_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 notemerge_request.notes[].created_at
;time
. Timestamp of the note creationmerge_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 botmerge_request.notes[].author.public_email
;optional string
. User’s public email-
merge_request.notes[].author.state
(enum) State of the userThe following values are valid:
active
User is active and can use the systemblocked
User has been blocked by an administrator and cannot use the systemdeactivated
User is no longer active and cannot use the systembanned
User is blocked, and their contributions are hiddenldap_blocked
User has been blocked by the systemblocked_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 emailmerge_request.first_commit.author_name
;optional string
. Commit authors namemerge_request.first_commit.authored_date
;optional time
. Timestamp of when the commit was authoredmerge_request.first_commit.committed_date
;optional time
. Timestamp of when the commit was committedmerge_request.first_commit.committer_email
;optional string
. Email of the committermerge_request.first_commit.committer_name
;optional string
. Name of the committermerge_request.first_commit.description
;optional string
. Description of the commit messagemerge_request.first_commit.full_title
;optional string
. Full title of the commit messagemerge_request.first_commit.id
;optional string
. ID (global ID) of the commitmerge_request.first_commit.message
;optional string
. Raw commit messagemerge_request.first_commit.sha
;string
. SHA1 ID of the commitmerge_request.first_commit.short_id
;string
. Short SHA1 ID of the commitmerge_request.first_commit.title
;optional string
. Title of the commit messagemerge_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 botmerge_request.first_commit.author.public_email
;optional string
. User’s public email-
merge_request.first_commit.author.state
(enum) State of the userThe following values are valid:
active
User is active and can use the systemblocked
User has been blocked by an administrator and cannot use the systemdeactivated
User is no longer active and cannot use the systembanned
User is blocked, and their contributions are hiddenldap_blocked
User has been blocked by the systemblocked_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 emailmerge_request.last_commit.author_name
;optional string
. Commit authors namemerge_request.last_commit.authored_date
;optional time
. Timestamp of when the commit was authoredmerge_request.last_commit.committed_date
;optional time
. Timestamp of when the commit was committedmerge_request.last_commit.committer_email
;optional string
. Email of the committermerge_request.last_commit.committer_name
;optional string
. Name of the committermerge_request.last_commit.description
;optional string
. Description of the commit messagemerge_request.last_commit.full_title
;optional string
. Full title of the commit messagemerge_request.last_commit.id
;optional string
. ID (global ID) of the commitmerge_request.last_commit.message
;optional string
. Raw commit messagemerge_request.last_commit.sha
;string
. SHA1 ID of the commitmerge_request.last_commit.short_id
;string
. Short SHA1 ID of the commitmerge_request.last_commit.title
;optional string
. Title of the commit messagemerge_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 botmerge_request.last_commit.author.public_email
;optional string
. User’s public email-
merge_request.last_commit.author.state
(enum) State of the userThe following values are valid:
active
User is active and can use the systemblocked
User has been blocked by an administrator and cannot use the systemdeactivated
User is no longer active and cannot use the systembanned
User is blocked, and their contributions are hiddenldap_blocked
User has been blocked by the systemblocked_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 botmerge_request.author.public_email
;optional string
. User’s public email-
merge_request.author.state
(enum) State of the userThe following values are valid:
active
User is active and can use the systemblocked
User has been blocked by an administrator and cannot use the systemdeactivated
User is no longer active and cannot use the systembanned
User is blocked, and their contributions are hiddenldap_blocked
User has been blocked by the systemblocked_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 botcurrent_user.public_email
;optional string
. User’s public email-
current_user.state
(enum) State of the userThe following values are valid:
active
User is active and can use the systemblocked
User has been blocked by an administrator and cannot use the systemdeactivated
User is no longer active and cannot use the systembanned
User is blocked, and their contributions are hiddenldap_blocked
User has been blocked by the systemblocked_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.