Currently merge checks work by adapting the new Hooks API merge check to look like the old one in scripts to preserve backwards compatibility.
We need to expose the new Hooks API merge check in scripts so users can make use of it in custom ones.
- We should provide the PreRepositoryHookContext and the PullRequestMergeHookRequest in the "hookContext" and "hookRequest" script bindings respectively to get additional data related to the hook invocation.
- Users should also be allowed to return a RepositoryHookResult to veto the merge and the veto messages should get displayed.
- The old merge check scripts should still continue working.
An example merge check can be found here.