Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Need to restrict new feature branch naming standard

Sonam_Moga1 November 28, 2024

 

Is it possible to restrict new feature branch creation with a naming standard (use similar regex /[A-Z]{2,}-\d+/g) for Bitbucket or another method maybe via webhook?

Thanks! 

2 answers

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 29, 2024

Hi @Sonam_Moga1,

I'm afraid there is no such feature available in Bitbucket Cloud. We have a feature request that you can vote for and watch here:

Webhooks can send a request to a server of yours after a certain event occurs. For example, if you use push as a trigger, the webhook will send a request after a push is made, so it cannot prevent the push.

You could use a webhook with a push trigger to check the name of the branch that is pushed, and in case it doesn't match a specific pattern, use our API to delete the branch:

Please keep in mind the following:

  • This might be a risky approach, because if something is not set up properly in this implementation, the automation may end up deleting branches that you actually want to keep. You may want to use branch restrictions in a repo or project to ensure that certain branches can never be deleted.
  • If you go with this approach, you may also want to configure your system to send (to the user who performed the push) an email or a message in a messaging app your team uses, mentioning that their branch was deleted, and that they'll need to rename it locally to match your naming standard and then push again.

Kind regards,
Theodora

0 votes
Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 28, 2024

Hi @Sonam_Moga1 ,

I recently answered a similar question here, which can be helpful to you as well.

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events