We have a pipeline that is triggered after the Pull request is merged in GitHub branch. And what I want is if the build fails in any of the stages of this pipeline after it has been triggered, I want to lock that branch in the GitHub. Could you help me in knowing how can that be done? We are using Jenkins 2.104. I would really appreciate your help.
The workflow is as follows (link to image)
- The code is merged on branch1 which triggers a build on pipeline1
- If pipeline1 fails it locks the branch1 so that there is no more trigger from branch1 to pipeline1, in the meanwhile user will figure out why pipeline1 failed and unlock the branch1