Skip to main content

project_merge_request

Gets or lists a project_merge_request resource.

Overview​

Nameproject_merge_request
TypeResource
Idgitlab.merge_requests.project_merge_request

Fields​

The following fields are returned by SELECT queries:

GraphQL response envelope

NameDatatypeDescription
idstringID of the merge request.
namestringName or title of the object.
project_idintegerID of the merge request project.
source_project_idintegerID of the merge request source project.
target_project_idintegerID of the merge request target project.
allow_collaborationbooleanIndicates if members of the target project can push to the fork.
allows_multiple_assigneesbooleanAllows assigning multiple users to a merge request.
allows_multiple_reviewersbooleanAllows assigning multiple reviewers to a merge request.
approvals_leftintegerNumber of approvals left.
approvals_requiredintegerNumber of approvals required.
approvedbooleanIndicates if the merge request has all the required approvals.
authorobjectMergeRequestAuthor identity (id, username, name)
auto_merge_enabledbooleanIndicates if auto merge is enabled for the merge request.
auto_merge_strategystringSelected auto merge strategy.
closed_atstringTimestamp of when the merge request was closed, null if not closed.
commit_countintegerNumber of commits in the merge request.
conflictsbooleanIndicates if the merge request has conflicts.
created_atstringTimestamp of when the merge request was created.
descriptionstringDescription of the merge request (Markdown rendered as HTML for caching).
detailed_merge_statusstringDetailed merge status of the merge request. (UNCHECKED, CHECKING, MERGEABLE, COMMITS_STATUS, CI_MUST_PASS, CI_STILL_RUNNING, DISCUSSIONS_NOT_RESOLVED, DRAFT_STATUS, NOT_OPEN, NOT_APPROVED, BLOCKED_STATUS, EXTERNAL_STATUS_CHECKS, PREPARING, JIRA_ASSOCIATION, CONFLICT, NEED_REBASE, APPROVALS_SYNCING, LOCKED_PATHS, LOCKED_LFS_FILES, MERGE_TIME, SECURITY_POLICIES_VIOLATIONS, TITLE_NOT_MATCHING, REQUESTED_CHANGES, SECURITY_POLICY_PIPELINE_CHECK)
discussion_lockedbooleanIndicates if comments on the merge request are locked to members only.
downvotesintegerNumber of downvotes for the merge request.
draftbooleanIndicates if the merge request is a draft.
force_remove_source_branchbooleanIndicates if the project settings will lead to source branch deletion after merge.
has_cibooleanIndicates if the merge request has CI.
hiddenbooleanIndicates the merge request is hidden because the author has been banned.
human_time_estimatestringHuman-readable time estimate of the merge request.
human_total_time_spentstringHuman-readable total time reported as spent on the merge request.
iidstringInternal ID of the merge request.
in_progress_merge_commit_shastringCommit SHA of the merge request if merge is in progress.
merge_afterstringDate after which the merge request can be merged.
merge_commit_shastringSHA of the merge request commit (set once merged).
merge_errorstringError message due to a merge error.
merge_ongoingbooleanIndicates if a merge is currently occurring.
merge_status_enumstringMerge status of the merge request. (UNCHECKED, CHECKING, CAN_BE_MERGED, CANNOT_BE_MERGED, CANNOT_BE_MERGED_RECHECK)
mergeablebooleanIndicates if the merge request is mergeable.
merged_atstringTimestamp of when the merge request was merged, null if not merged.
milestoneobjectMilestone identity (id, title)
prepared_atstringTimestamp of when the merge request was prepared.
projectobjectProject identity (id, full_path, name)
rebase_commit_shastringRebase commit SHA of the merge request.
referencestringInternal reference of the merge request. Returned in shortened format by default.
resolvable_discussions_countintegerNumber of user discussions that are resolvable in the merge request.
resolved_discussions_countintegerNumber of user discussions that are resolved in the merge request.
retargetedbooleanIndicates if merge request was retargeted.
should_remove_source_branchbooleanIndicates if the source branch of the merge request will be deleted after merge.
source_branchstringSource branch of the merge request.
squashbooleanIndicates if the merge request is set to be squashed when merged. [Project settings](https:​//docs.gitlab.com/user/project/merge_requests/squash_and_merge/#configure-squash-options-for-a-project) may override this value. Use squash_on_merge instead to take project squash options into account.
squash_on_mergebooleanIndicates if the merge request will be squashed when merged.
squash_read_onlybooleanIndicates if squashReadOnly is enabled.
statestringState of the merge request. (merged, opened, closed, locked, all)
supports_lock_on_mergebooleanIndicates if the merge request supports locked labels.
target_branchstringTarget branch of the merge request.
target_branch_existsbooleanIndicates if the target branch of the merge request exists.
target_branch_pathstringPath to the target branch of the merge request.
time_estimateintegerTime estimate of the merge request.
titlestringTitle of the merge request.
total_time_spentintegerTotal time (in seconds) reported as spent on the merge request.
updated_atstringTimestamp of when the merge request was last updated.
upvotesintegerNumber of upvotes for the merge request.
user_discussions_countintegerNumber of user discussions in the merge request.
user_notes_countintegerUser notes count of the merge request.
web_pathstringWeb path of the merge request.
web_urlstringWeb URL of the merge request.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfull_path, iid, hostA single merge request of the project. Generated from the GitLab GraphQL schema field Project.mergeRequest (MergeRequest).

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
full_pathstringFull path of the project, for example gitlab-org/gitlab
hoststringGitLab host, with an optional port (default gitlab.com). Resolved from the GITLAB_HOST environment variable when it is set (x-stackQL-envVar); a WHERE host value always takes precedence. Self-managed instances: the provider is generated from the gitlab.com schema, so older instances may reject fields they do not serve. (default: gitlab.com, x-stackQL-envVar: GITLAB_HOST)
iidstringIID of the merge request, for example 1.

SELECT examples​

A single merge request of the project. Generated from the GitLab GraphQL schema field Project.mergeRequest (MergeRequest).

SELECT
id,
name,
project_id,
source_project_id,
target_project_id,
allow_collaboration,
allows_multiple_assignees,
allows_multiple_reviewers,
approvals_left,
approvals_required,
approved,
author,
auto_merge_enabled,
auto_merge_strategy,
closed_at,
commit_count,
conflicts,
created_at,
description,
detailed_merge_status,
discussion_locked,
downvotes,
draft,
force_remove_source_branch,
has_ci,
hidden,
human_time_estimate,
human_total_time_spent,
iid,
in_progress_merge_commit_sha,
merge_after,
merge_commit_sha,
merge_error,
merge_ongoing,
merge_status_enum,
mergeable,
merged_at,
milestone,
prepared_at,
project,
rebase_commit_sha,
reference,
resolvable_discussions_count,
resolved_discussions_count,
retargeted,
should_remove_source_branch,
source_branch,
squash,
squash_on_merge,
squash_read_only,
state,
supports_lock_on_merge,
target_branch,
target_branch_exists,
target_branch_path,
time_estimate,
title,
total_time_spent,
updated_at,
upvotes,
user_discussions_count,
user_notes_count,
web_path,
web_url
FROM gitlab.merge_requests.project_merge_request
WHERE full_path = '{{ full_path }}' -- required
AND iid = '{{ iid }}' -- required
AND host = '{{ host }}' -- required (defaults to gitlab.com; or set GITLAB_HOST)
;