theapsgroup/gitlab

steampipe plugin install theapsgroup/gitlabsteampipe plugin install theapsgroup/gitlab

Table: gitlab_merge_request

The gitlab_merge_request table can be used to query all merge requests in the GitLab instance.

Note: When used with the Public GitLab you must specify an = qualifier for at least one of the following fields.

  • reviewer_id
  • assignee_id
  • author_id
  • project_id

This is to prevent attempting to return ALL public merge requests which would result in an error.

Examples

List all merge requests

select
*
from
gitlab_merge_request;

List of merge requests for a specific project

select
*
from
gitlab_merge_request
where
project_id = 12345;

List of merge requests which have been merged in the last week

select
project_id,
title,
state,
target_branch,
source_branch,
merged_at,
merged_by_username
from
gitlab_merge_request
where
state = 'merged'
and
merged_at >= (current_date - interval '7' day);

List all merge requests for your projects

select
p.name as project_name,
p.id as project_id,
m.id as mr_id,
m.title as mr_title,
m.state as mr_state,
m.assignee_username as mr_assignee
from
gitlab_my_project as p,
gitlab_merge_request as m

.inspect gitlab_merge_request

All GitLab Merge Requests

NameTypeDescription
allow_collaborationbooleanIndicates if collaboration is allowed on the merge request.
approvals_before_mergebigintThe number of approvals required before merge can proceed.
assignee_idbigintThe ID of the assignee - link to `gitlab_user.id`.
assignee_usernametextThe username of the assignee - link to `gitlab_user.username`.
assigneesjsonbAn array of assigned usernames, for when more than one user is assigned.
author_idbigintThe ID of the author - link to `gitlab_user.id`.
author_usernametextThe username of the author - link to `gitlab_user.username`.
changes_countbigintA count of changes contained within the merge request.
closed_attimestamp without time zoneTimestamp of when merge request was closed.
closed_by_idbigintThe ID of the user who closed the merge request - link to `gitlab_user.id`.
closed_by_usernametextThe username of the user who closed the merge request - link to `gitlab_user.username`.
created_attimestamp without time zoneTimestamp of merge request creation.
descriptiontextThe description of the merge request.
discussion_lockedbooleanIndicates if the merge request has the discussions locked against new input.
diverged_commits_countbigintA count of commits diverged from target_branch.
downvotesbigintCount of down-votes received on the issue.
force_remove_source_branchbooleanIndicates if source_branch will be force deleted on merge.
has_conflictsbooleanIndicates if the merge request has conflicts with the target_branch.
idbigintThe global ID for the merge request.
iidbigintThe internal ID to the project for the merge request
merge_commit_shatextThe hash of the merge commit.
merge_errortextError message if the merge request can not be merged.
merge_statustextDescriptive status about the ability of being able to merge the merge request.
merge_when_pipeline_succeedsbooleanIndicates if the merge request will be merged upon completion of CI/CD pipeline.
merged_attimestamp without time zoneTimestamp of when merge request was merged.
merged_by_idbigintThe ID of the user who merged the merge request - link to `gitlab_user.id`.
merged_by_usernametextThe username of the user who merged the merge request - link to `gitlab_user.username`.
project_idbigintThe ID of the project containing the merge request - link to `gitlab_project.ID`
rebase_in_progressbooleanIndicates if a rebase is in progress.
referencetextThe reference code of the merge request (example: `!4`.
reviewer_idbigint
reviewersjsonbAn array of usernames who've been asked to review the merge request.
shatext
should_remove_source_branchbooleanIndicates if source_branch should be deleted on merge.
source_branchtextThe source branch of the merge request.
squashbooleanIndicates if a squash is requested.
squash_commit_shatextThe hash of the squashed merge commit.
statetextThe state of the merge request (open, closed, merged)
subscribedbooleanIndicates if the user associated to the token used to access the data is subscribed to the merge request.
target_branchtextThe target branch for the merge request.
titletextThe title of the merge request.
updated_attimestamp without time zoneTimestamp of last update to the issue.
upvotesbigintCount of up-votes received on the merge request.
user_notes_countbigintA count of user notes on the merge request.
web_urltextThe url to access the merge request.
work_in_progressbooleanIndicates if the merge request is a work in progress.