We are trying to build a plugin that checks that every commit has a JIRA ticket when doing a pull request merge. But when the merge strategy is set to squash we only need to check the merge commit. Therefore, when we do a merge check we need to get the merge strategy so that we can determine if the MergeRequest object is a squash or regular merge.
From what we can gather, it seems like we need to get hold of a PullRequestMergeRequest object (https://developer.atlassian.com/static/javadoc/bitbucket-server/4.12.1/api/reference/com/atlassian/bitbucket/pull/PullRequestMergeRequest.html), Is this possible in any way?
Community moderators have prevented the ability to post new answers.
Actually you need to check Settings via MergeConfig, but unfortunately it's internal and cannot be used in plugins
Use GET https://bitbucket.acme.com/rest/api/1.0/projects/PROJECT_1/repos/repo_1/settings/pull-requests
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But the user can, at merge time, set the merge strategy via dropdown selector. If I am not mistaken, that would only give me the repository settings and not the user selected action?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's special option from Repository Settings. It can be disabled and can be used only restricted merge strategy.
Unfortunately you can't get from plugin such setting. See ScmService and find for MergeStrategy usages. You need MergeConfig which is internal (located in internal package), and all internall stuff does not accessible from plugins.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.