The existing protected branch test could be useful
Docs: https://docs.gitlab.com/ee/user/project/protected_branches.html#restricting-push-and-merge-access-to-certain-users-starter
Related epic: gitlab-org&1669