A merge request check module defines a Java component that can veto a request by a user to merge a pull request. A vetoed pull request will be prevented from merging and feedback is given to the user explaining why the merge can't proceed.
Example merge request checks might include:
Note: although merge request checks restrict the merge operation within Bitbucket Server, they do not prevent users from merging branches in their local clones and pushing this change. Please look at branch permissions for this functionality.
The root element for the Merge Request Check plugin module is . It allows the following two attributes for configuration:
|key||Yes||The identifier of the plugin module. This key must be unique within the plugin where it is defined.||N/A|
|class||Yes||The fully qualified Java class name of merge request check. This class must implement MergeRequestCheck.||N/A|
Here is an example file containing a single merge check:
1 2 3 4 5 6 7 8 9
<atlassian-plugin name="My Merge Request Check" key="example.plugin.mycheck" plugins-version="2"> <plugin-info> <description>A basic component import module test</description> <vendor name="My Company" url="http://www.mycompany.com"/> <version>1.0</version> </plugin-info> <merge-check key="myMergeCheck" class="com.mycompany.example.plugin.myCheck.MyMergeRequestCheck"/> </atlassian-plugin>
See also the tutorial on Controlling when pull requests can be merged