Is it possible to write custom approval rules?

With GitLab Premium, under the project’s Settings > Merge request approvals > Approval rules section, besides the standard Approvals required field, I can see there is also a License-Check rule and Coverage-Check rule that can be enabled, and what they do is pretty self-explanatory. I’m curious how those two are implemented and if it’s possible to add other custom rules like them.

For example, we’d like to set a rule that only a subset of the team can approve “large” merge requests (where “large” is defined by the number of lines changed, as reported by git log). I imagine that would be something similar to License-Check or Coverage-Check, but written by us. Is that possible?

I think custom approval rules are a premium feature. If you are on the free tier, I suspect the best you can do is to add an early stage to your CI pipeline which will fail if your rules are not met.

As per the first words in my question, we are on GitLab Premium. We have enabled the basic “approvals required” rule and that works well for us. What we want now is to write a custom approval rule. For example: “if the merge request has changed more than 200 lines, then only Joe and Bill can approve it”. How could we do that?

Apologies, code for the license finder is here and the other analysers are in this sub-group.

I believe these are all off-the-shelf lints, which are run from Docker containers, but I haven’t looked through many of them!