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.
Related
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
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.
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.
I"m trying to get the objectID(SHa1d) of a commit.
Is there a way to retrieve the value?
You can get the objectId through Refs - List rest api.
https://dev.azure.com/{organization}/_apis/git/repositories/{repositoryId}/refs?filter=tags/&api-version=5.1-preview.1
However, if you want to get the information of annotatedtags from the commit's response, I am afraid this is currently not possible. The commit's response currently does not contain tags information.
Here is a uservoice for the same issue has been submitted on Developer Community forum. You can vote and add your comments for this feedback. Our PM and Product Group are reviewing these suggestion regularly and considering take it as plan.
In addition, you can retrieve tags based on commit id from Repos-> Tags in web UI.
The Commits - Get Commits API for Azure DevOps Git should serve the Commit ID as well in the response, along with retrieving git commits for a project. Check out the examples given in the same page for looking at some sample requests and responses.
Here is one:
Hope this helps!
On the GitHub website, it is possible to list PRs reviewed by a user for a specific repository with the filter query is:pr reviewed-by:your-github-username. See example.
But I can't find how to replicate this functionality using the GitHub API. Is there a query you can make that will do something like GET /repos/:owner/:repo/pulls/reviewedby/:reviewer?
The search endpoint turned out to be the key. Example request:
https://api.github.com/search/issues?q=+type:pr+repo=facebook/react+reviewed-by:bvaughn