can we customize merge functionality?

I have got a use case where I need to do the check just before merge.

In this scenario a user pushes a code raise pull request, next pushes more code pull requests or updates and finally gets ready to merge. When the user clicks on the Merge, I need to do the “final check” before proceeding. If the check passes, the merge is allowed to proceed, else the merge should be declined and the user should be asked to correct the code so that it be able to pass the “final check”. Is this possible to do with github ?

Any other workarounds are welcome as well.

Note: final check is a Jenkins job.

I have seen the merge event fires as a push event to base branch. Also I couldn’t find any event which can hold the merge after clicking the Merge button till the event has completed.

Hi @madhukulkarni,

Thanks for being here! There isn’t a straightforward way to accomplish this as far as I know, one work around would be to have a bot listening on webhooks which trigger for pull request reviews. After the right number of reviews have been posted, the bot would post a comment with a link. This link, when clicked, would trigger the “finalcheck” tests to run.

Maybe someone else here has a similar workflow and can share. I hope this helps