How to check merged commits for specific message in a merge request created on GitLab with hooks

Viewed 322

I'm looking for a way to check all merged commits (commits that are being merged into the target branch) for a specific message. All commit messages must have a specific format, they must have the same number in it as the branch (source branch) that is being merged. The regex for checking if the strings are correct is not a big deal that I have done already, what I'm trying to figure out is if I would use for that Server-Side Hooks or the Client Hooks and how to get the required information in the script (merge message, source branch and commits being merged into the target branch).

Regarding the merge, it's always a merge request created on GitLab, never a merge created locally and pushed.

I also need a possibility to skip such a verification in special cases, how would I do that? Locally I would add a --no-verify but I can't do that with MRs on GitLab. Would I add a keyword in the merge message and check for that in the hook script and skip if I find it?

0 Answers
Related