More merge request data is available via the API and usable for filtering
Description
The API for merge requests would benefit from having a "merged_at" and a "merged_by", and the ability to filter by them. We have "created_at" and "updated_at", but "merged_at" would be useful so we can look up when something was merged - it isn't necessarily always the last "updated_at" value. Similarly, we have "author" and "assignee", but that isn't necessarily who merged the MR.
Proposal
API output for a merge request has these additional items within the JSON element once a merge request has actually been merged - this never appears if the MR is just closed and never actually merged, of course:
"merged_at": "2017-07-12T14:26:23.160Z",
"merged_by": {
"name": "Joe Bloggs",
"username": "jbloggs",
"id": 52,
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/qwertyuiopasdfghjkl?s=80&d=identicon",
"web_url": "https://git.mydomain.com/jbloggs"
},
Similarly, the following additional filters would work using the "merged_at" date:
merged_after datetime no Return merge requests merged after the given time (inclusive)
merged_before datetime no Return merge requests merged before the given time (inclusive)
And this would work using the "merged_by" user data:
merger_id integer no Returns merge requests merged by the given user id.
So in order to get a list of merge requests merged by Joe Bloggs in June, I could make a GET request like this:
Links / references
Current API docs for MRs - https://docs.gitlab.com/ee/api/merge_requests.html
Documentation blurb
See above.
Overview
What is it? Additional API filters to see when things were actually merged and by whom via the API.
Why should someone use this feature? Someone interested in these metrics for integration with an external service, sometimes to measure velocity, sometimes to have a list of requests to check for integrity / security, possibly for audit purposes.
What is the underlying (business) problem? In our case, we needed a list of MRs merged between two dates by a specific person, which we had to review for governance / security audit reasons.
How do you use this feature? Via the API.
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
-
Feature assurance -
Documentation -
Added to features.yml