make jira issue mandatory during commit or pull request
Asked by Ashish Saini:

Hello Community,

Need help please

For better tracebiliy ,we want to make sure developers mentioned jira issue number dueing commit or pull request

How can we achieve it in bitbucket cloud

I am new to bitbucket , so please excuse if this is a simple question

Thanks


Answers:
author: Theodora Boudale
body: Hi [@Ashish Saini](/t5/user/viewprofilepage/user-id/4159494),

There is a setting on the repository level to require an issue key in commit messages.

Can you please confirm if you are using Jira Cloud? If so, the first step is to double-check if the Bitbucket workspace that owns the repos you are working on, is already integrated with your Jira Cloud instance (and if not, integrate them).

1. Log in to <https://bitbucket.org/>
2. Select your avatar \> **All workspaces**
3. Select the workspace that owns the repos your team is working on
4. Select the option **Settings** from the sidebar (you'll need to be an admin of the workspace to see this option)
5. Then select **Jira** from the new sidebar

If you see the Jira Cloud instance you use listed there, with the option **Disconnect** , it means the integration is already in place. Otherwise, you will see a link **Connect**. You can use that to make the integration (you'll also need to be an admin in Jira to perform this).

After you confirm that the integration is there:

1. Open a repository of this workspace in your browser
2. Select from the sidebar \> **Repository settings** \> **Links**
3. You should be able to see some Read-only links for Jira. You will also see an option **Require issue keys in commit messages**. If you enable that, users will not be able to push any commits that don't have an issue key in their commit message.

We don't have a setting to require an issue key in PR titles and/or description. There is a feature request about this in our issue tracker that you can vote for if you'd be interested in that:

* <https://jira.atlassian.com/browse/BCLOUD-20353>

I'd like to mention here that if a PR is created without referencing an issue key, but the commits of the source branch have issue keys in their messages, then this PR will still be displayed in the respective issues in Jira.

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora

comments: author: Ashish Saini
body: Thanks [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) for such a nice and details description

I will try the steps mentioned and update you :)

Thanks

Ashish


author: Theodora Boudale
body: You are welcome Ashish, I'll wait to hear your update then!


author: Ashish Saini
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) : Hi Theodora . i tried the solution and it worked

However , it is also allowing invalid jira issues as well in the commit

For example : I have AC-5 as a valid jira issue and it allows commit

When i try with AC-55 , this issue is not available in jira itself ..still it allows the commit

How can we avoid invalid issues during commit

Can you please advice

Thanks  
Ashish


author: Theodora Boudale
body: Hi Ashish,

Thank you for your reply.

The links in commit messages are created based on regular expressions. At the moment, I'm afraid that we don't do an issue validity check before creating a link.

We have a feature request about this in our issue tracker:

* <https://jira.atlassian.com/browse/BCLOUD-20644>

If you're interested in this, I would suggest that you add your vote in the feature request (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora


author: Ashish Saini
body: Thank you [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) for the support and update

It was really helpful

Glad to be part of Atlassian Community

Thanks  
Ashish


author: Theodora Boudale
body: You are very welcome Ashish, I'm more than glad to have helped.

Please don't hesitate to reach out if you ever need anything else!

Kind regards,  
Theodora


author: Tamir Melamed
body: Is it also possible with GitHub?

comments: author: Theodora Boudale
body: Hi Tamir,

I'm not aware of that. The repository links and the option "Require issue keys in commit messages" are a Bitbucket feature and the links are not limited to Jira. You can reach out to GitHub support team to ask if such a feature is available in GitHub.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud