RepositoryMergeCheck example is not working

Hi

I am trying to implement pre-merge check plugin and using this example https://bitbucket.org/atlassian/bitbucket-server-example-plugins/src/366f0a2515f7a23c9beee81d1524b54e7983b401/hooks-guide/src/main/java/com/atlassian/bitbucket/server/examples/EnforceApprovalsMergeCheck.java?at=master which is explained here https://developer.atlassian.com/server/bitbucket/how-tos/hooks-merge-checks-guide/

I am using Bitbucket v5.16.2 and

int requiredApprovals = context.getSettings().getInt(“approvals”, 0);

is always returning 0. I need to get requiredApprovers from REST address /bitbucket/rest/api/1.0/projects/PROJECTNAME/repos/REPONAME/settings/pull-requests

and trying to get the value with code behind. without calling rest. I tried couple of ways but so far “context” and settings related objects are always empty or null. in our bitbucket we use bitbucket-plugin-bundled-hooks.internal.feature.requiredapprovers. can you tell how can I get requiredApprovers ?

Thank

1 Like