This requires the pull request to reference a valid Jira issue, where the supplied JQL query defines what’s valid. The issue can either be mentioned in the pull request title, or be present in one of the commit messages comprising the pull request. See also the version that works on push.

Unresolved directive in <stdin> - include::{projectdir}/docs/content/bitbucket/application-links.adoc[]

A sample query might be:

  • The issue is "in progress" and assigned to the user attempting to merge the pull request:

status = "In Progress" and assignee = currentUser()

  • You could also require that the pull request references a particular Jira project:

project = FOO

If the merge check doesn’t allow the merge, the user will need to edit the pull request title, or rebase and push.

Unresolved directive in <stdin> - include::{projectdir}/docs/content/bitbucket/dynamic-jql-clause.adoc[]

Can Only Merge to a Valid Release Branch

The following JQL clause template ensures that the target branch name corresponds to a fix version in Jira before merging.

`!`fixVersion = '${mergeRequest.pullRequest.toRef.displayId}'

This enforces that any changes can be traced back to a particular release through Jira.

Require Each Commit to be Associated with a Valid Jira Issue

It may be desirable for each commit to be associated with at least one Jira issue, this can be useful for tracking all commits back to a Jira issue.

This restriction can be optionally enabled for the merge check by checking the Require Valid Jira Issue in Every Commit? checkbox. With this checkbox checked, the merge of the pull request will be blocked if any commit exists without at least one valid Jira issue referenced in the commit message.