Add a new `reviewed_by` variable for commit messages
What does this MR do and why?
Two commits:
- Reviews are currently stored in the
reviews
database table, and a merge request has areviews
association. This commit adds a newhas_many :reviewed_by_users, -> { distinct }, through: :reviews, source: :author
to streamline the gathering of historical unique reviewers of a merge request. - The Merge commit template now supports the
%{reviewed_by}
placeholder. For each reviewers of a merge request (i.e. people that submitted a review), the Merge commit message will include aReviewed-by:
Git trailer.
Screenshots or screen recordings
How to set up and validate locally
- Add
%{reviewed_by}
to the Merge commit template of a project - Open a merge request from this project
- Perform two separate reviews with the same user and one with another user
- Merge the merge request
- Open the merge commit and check that it has two
Reviewed-by:
trailers (one for the first reviewer, one for the second one)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #378352 (closed)
Edited by Nick Veenhof