Can I tell who approved merge requests? - gitlab

I have GitLab Starter which seems to mean that I am unable to restrict code approvers on a directory basis as everyone needs developer level access.
This is causing slight headaches.
Is there a way in GitLab that I can review who approved groups of merge requests? This way I can at least check after the fact that no one has approved code who should not have.
Is there a way to query the backend database or a way of gaining this information in some GUI screen somewhere?

There will be a way, with the upcoming GitLab 13.5 to clearly see the status of the approval process and who has approved a MR.
In the meantime, you still have the GitLab Merge Request approval API and the merge request API, with a call like GET /merge_requests does include paramters like approver_ids
Returns merge requests which have specified all the users with the given ids as individual approvers.
None returns merge requests without approvers.
Any returns merge requests with an approver.
That could help checking who has approved a MR.
Users on GitLab Starter, Bronze, or higher will also see the approvals_before_merge parameter.

Related

Is there a GitLab REST endpoint/GraphQL solution to fetch changes requested on merge requests?

I am using this endpoint /api/v4/groups/::group_id/merge_requests to fetch merge requests in a group.
However what I need is the number of times changes were requested on a particular merge request, and the content of those requests if possible.
While working with GitHub, fetching count of review comments is possible with repos/{orgName}/{repoName}/pulls/{pullNumber}, which returns a field
{"review_comments": 0} as the number of review comments on the pull request.
Is the same possible with the available GitLab REST endpoints?
There is a thread in the GitLab forum on this that could help.
https://forum.gitlab.com/t/gitlab-rest-api-endpoint-for-changes-requested-on-merge-requests/77164/4

How to query if a GitLab merge request supports multiple reviewers?

GitLab's documentations say that a merge request can be updated to add one or more reviewers via the reviewer_ids property: https://docs.gitlab.com/ee/api/merge_requests.html#update-mr
What seems strange to me is that certain projects or merge requests or users seem to have the ability to add more than one reviewer to a merge request, while others can only have one reviewer. This is viewable in the UI at gitlab.com, with some merge requests having more than 1 reviewer (see screenshot below), while my free account only seems to allow 1 reviewer on a merge request.
Via the GitLab api, how can I detect whether a given merge request can support more than 1 reviewer? If not at the merge request level, is this something at the project or user level?
For some additional context, I'm working on building a VSCode extension for CodeStream to enable support for GitLab merge requests, and the ability to add reviewers is part of its functionality.

How to create a merge request review from the GitLab api?

I'm trying to replicate the ability to add reviews to GitLab merge requests in my app and I don't see anything in the api documentation related to merge request reviews or merge request draft notes.
On the web version of GitLab, when I create a comment on a line of code in a commit and I select 'Start a review', I can see a POST to http://<myInstance>/<myProject/-/merge_requests/<id>/drafts. If I execute a GET on that, I can see my pending review comment (note) in the response.
Is there anyway to create / read / update / delete merge request reviews with the GitLab api?
Currently, as of Gitlab 13.9, there is no support for this. The closest it gets for an API for Merge Request Reviews is this issue/feature request asking for an API to retrieve Review comments: https://gitlab.com/gitlab-org/gitlab/-/issues/12297
If you're a paid user, contacting support/sales is a good option since they tend to add features themselves when paid users request it, but tend to let the community add an Open Source contribution otherwise.

How do you see all merge requests where you are an approver in Gitlab?

I'd like to see all the pending merge requests where I am listed as an approver. How do I find them? Currently, I can only see how to filter for merge requests by assignee or author, not approver. Outside of e-mail, how do you figure out which merge requests you need to respond to and review?
Currently, you can't.
However, there is work in progress to be able to list MRs by approver.

Notify all participants about merge request

Is there a way to notify all gitlab project participants about new merge request, so they can review changes and vote? At the moment only a responsible person is notified and this is IMHO not very well team-oriented.
If this isn't supported, that would be a feature request to add to the "feedback.gitlab.com" page.
But consider also "Notify only requester and not whole team on comment in merge request":
the whole team is notified via email when someone comments on a merge request.
Please add the functionality to just notify the one who created the merge request to be notified
This is done since 5.3, which means a comment on a change request should notify a group, and not just the owner.

Resources