project_merge_requests
Gets or lists a project_merge_requests resource.
Overview​
| Name | project_merge_requests |
| Type | Resource |
| Id | gitlab.merge_requests.project_merge_requests |
Fields​
The following fields are returned by SELECT queries:
- list
GraphQL response envelope
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the merge request. |
name | string | Name or title of the object. |
project_id | integer | ID of the merge request project. |
source_project_id | integer | ID of the merge request source project. |
target_project_id | integer | ID of the merge request target project. |
allow_collaboration | boolean | Indicates if members of the target project can push to the fork. |
allows_multiple_assignees | boolean | Allows assigning multiple users to a merge request. |
allows_multiple_reviewers | boolean | Allows assigning multiple reviewers to a merge request. |
approvals_left | integer | Number of approvals left. |
approvals_required | integer | Number of approvals required. |
approved | boolean | Indicates if the merge request has all the required approvals. |
author | object | MergeRequestAuthor identity (id, username, name) |
auto_merge_enabled | boolean | Indicates if auto merge is enabled for the merge request. |
auto_merge_strategy | string | Selected auto merge strategy. |
closed_at | string | Timestamp of when the merge request was closed, null if not closed. |
commit_count | integer | Number of commits in the merge request. |
conflicts | boolean | Indicates if the merge request has conflicts. |
created_at | string | Timestamp of when the merge request was created. |
description | string | Description of the merge request (Markdown rendered as HTML for caching). |
detailed_merge_status | string | Detailed 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_locked | boolean | Indicates if comments on the merge request are locked to members only. |
downvotes | integer | Number of downvotes for the merge request. |
draft | boolean | Indicates if the merge request is a draft. |
force_remove_source_branch | boolean | Indicates if the project settings will lead to source branch deletion after merge. |
has_ci | boolean | Indicates if the merge request has CI. |
hidden | boolean | Indicates the merge request is hidden because the author has been banned. |
human_time_estimate | string | Human-readable time estimate of the merge request. |
human_total_time_spent | string | Human-readable total time reported as spent on the merge request. |
iid | string | Internal ID of the merge request. |
in_progress_merge_commit_sha | string | Commit SHA of the merge request if merge is in progress. |
merge_after | string | Date after which the merge request can be merged. |
merge_commit_sha | string | SHA of the merge request commit (set once merged). |
merge_error | string | Error message due to a merge error. |
merge_ongoing | boolean | Indicates if a merge is currently occurring. |
merge_status_enum | string | Merge status of the merge request. (UNCHECKED, CHECKING, CAN_BE_MERGED, CANNOT_BE_MERGED, CANNOT_BE_MERGED_RECHECK) |
mergeable | boolean | Indicates if the merge request is mergeable. |
merged_at | string | Timestamp of when the merge request was merged, null if not merged. |
milestone | object | Milestone identity (id, title) |
prepared_at | string | Timestamp of when the merge request was prepared. |
project | object | Project identity (id, full_path, name) |
rebase_commit_sha | string | Rebase commit SHA of the merge request. |
reference | string | Internal reference of the merge request. Returned in shortened format by default. |
resolvable_discussions_count | integer | Number of user discussions that are resolvable in the merge request. |
resolved_discussions_count | integer | Number of user discussions that are resolved in the merge request. |
retargeted | boolean | Indicates if merge request was retargeted. |
should_remove_source_branch | boolean | Indicates if the source branch of the merge request will be deleted after merge. |
source_branch | string | Source branch of the merge request. |
squash | boolean | Indicates 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_merge | boolean | Indicates if the merge request will be squashed when merged. |
squash_read_only | boolean | Indicates if squashReadOnly is enabled. |
state | string | State of the merge request. (merged, opened, closed, locked, all) |
supports_lock_on_merge | boolean | Indicates if the merge request supports locked labels. |
target_branch | string | Target branch of the merge request. |
target_branch_exists | boolean | Indicates if the target branch of the merge request exists. |
target_branch_path | string | Path to the target branch of the merge request. |
time_estimate | integer | Time estimate of the merge request. |
title | string | Title of the merge request. |
total_time_spent | integer | Total time (in seconds) reported as spent on the merge request. |
updated_at | string | Timestamp of when the merge request was last updated. |
upvotes | integer | Number of upvotes for the merge request. |
user_discussions_count | integer | Number of user discussions in the merge request. |
user_notes_count | integer | User notes count of the merge request. |
web_path | string | Web path of the merge request. |
web_url | string | Web URL of the merge request. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | full_path, host | assignee_username, assignee_wildcard_id, author_username, closed_after, closed_before, created_after, created_before, deployed_after, deployed_before, deployment_id, draft, environment_name, merged_after, merged_before, merged_by, milestone_title, milestone_wildcard_id, my_reaction_emoji, release_tag, reviewer_username, reviewer_wildcard_id, search, sort, state, subscribed, updated_after, updated_before | Merge requests of the project. Generated from the GitLab GraphQL schema field Project.mergeRequests (connection of MergeRequest nodes). |
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.
| Name | Datatype | Description |
|---|---|---|
full_path | string | Full path of the project, for example gitlab-org/gitlab |
host | string | GitLab 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) |
assignee_username | string | Username of the assignee. |
assignee_wildcard_id | string | Filter by assignee presence. Incompatible with assigneeUsernames and assigneeUsername. |
author_username | string | Username of the author. |
closed_after | string | Merge requests closed after the date. |
closed_before | string | Merge requests closed before the date. |
created_after | string | Merge requests created after the timestamp. |
created_before | string | Merge requests created before the timestamp. |
deployed_after | string | Merge requests deployed after the timestamp. |
deployed_before | string | Merge requests deployed before the timestamp. |
deployment_id | string | ID of the deployment. |
draft | boolean | Limit result to draft merge requests. |
environment_name | string | Environment merge requests have been deployed to. |
merged_after | string | Merge requests merged after the date. |
merged_before | string | Merge requests merged before the date. |
merged_by | string | Username of the merger. |
milestone_title | string | Title of the milestone. Incompatible with milestoneWildcardId. |
milestone_wildcard_id | string | Filter issues by milestone ID wildcard. Incompatible with milestoneTitle. |
my_reaction_emoji | string | Filter by your reaction emoji. |
release_tag | string | Filter by release tag. |
reviewer_username | string | Username of the reviewer. |
reviewer_wildcard_id | string | Filter by reviewer presence. Incompatible with reviewerUsername. |
search | string | Search query for title or description. |
sort | string | Sort merge requests by the criteria. |
state | string | Merge request state. If provided, all resolved merge requests will have the state. |
subscribed | string | Merge requests the current user is subscribed to. |
updated_after | string | Merge requests updated after the timestamp. |
updated_before | string | Merge requests updated before the timestamp. |
SELECT examples​
- list
Merge requests of the project. Generated from the GitLab GraphQL schema field Project.mergeRequests (connection of MergeRequest nodes).
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_requests
WHERE full_path = '{{ full_path }}' -- required
AND host = '{{ host }}' -- required (defaults to gitlab.com; or set GITLAB_HOST)
AND assignee_username = '{{ assignee_username }}'
AND assignee_wildcard_id = '{{ assignee_wildcard_id }}'
AND author_username = '{{ author_username }}'
AND closed_after = '{{ closed_after }}'
AND closed_before = '{{ closed_before }}'
AND created_after = '{{ created_after }}'
AND created_before = '{{ created_before }}'
AND deployed_after = '{{ deployed_after }}'
AND deployed_before = '{{ deployed_before }}'
AND deployment_id = '{{ deployment_id }}'
AND draft = '{{ draft }}'
AND environment_name = '{{ environment_name }}'
AND merged_after = '{{ merged_after }}'
AND merged_before = '{{ merged_before }}'
AND merged_by = '{{ merged_by }}'
AND milestone_title = '{{ milestone_title }}'
AND milestone_wildcard_id = '{{ milestone_wildcard_id }}'
AND my_reaction_emoji = '{{ my_reaction_emoji }}'
AND release_tag = '{{ release_tag }}'
AND reviewer_username = '{{ reviewer_username }}'
AND reviewer_wildcard_id = '{{ reviewer_wildcard_id }}'
AND search = '{{ search }}'
AND sort = '{{ sort }}'
AND state = '{{ state }}'
AND subscribed = '{{ subscribed }}'
AND updated_after = '{{ updated_after }}'
AND updated_before = '{{ updated_before }}'
;