How to create a custom pre-merge widget using a script

Hi,

We have a stage in our pipeline which runs a script and checks if some housekeeping has been done. If the branch does not have the house keeping done, the CI for the branch fails and the user is unable to merge their changes.

I think a neater way would be to have a merge-request widget which changes to “house keeping done” when the script passes, rather than the pipeline appearing that it is broken. That way when the user goes to finish the merge request, they will see the widget and merge request is blocked until the house keeping is finished.

Are there any tutorials for building custom merge request widgets or can anyone recommend how I would do that?

Thanks!