It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to enforce naming conventions using ScriptRunner add-on with Bitbucket

Mary Slocum Jul 02, 2018

Hello,

Using ScriptRunner add-on 5.1.8 with Bitbucket 5.3.2, is there a way to enforce naming conventions for projects and repos? If so, how?

I see that there is enforcing naming conventions for feature and bugfix branches using the Pre-receive Hooks, but is there anything for project and repo names?

Thanks,

Mary

2 answers

1 accepted

0 votes
Answer accepted
Adam Markham [Adaptavist] Community Leader Jul 04, 2018

You could do that using a custom event handler.

For example you can use the following script for the ProjectCreationRequestedEvent. You'll need to change the regex part. At the moment it enforces that project keys must begin with a C followed by at least one upper case character in A-Z.

def regex = "C[A-Z]+"

if (! (event.project.key ==~ /${regex}/)) {
event.cancel("Project key must start with C!")
}

Let us know how that goes.

Mary Slocum Jul 04, 2018

Works great! Thank you so much for your help :)

 

Mary

0 votes
Adam Markham [Adaptavist] Community Leader Jul 03, 2018

Hi Mary,

There is an event handler for that using ScriptRunner. It's called "Naming standard enforcement" with the description "Enforce project and repository naming standards".

The documentation can be found here but it's works similarly to the branch and tag naming convention one.

Let us know how you get on.

Thanks,
Adam

Mary Slocum Jul 03, 2018

Thanks, Adam!

I was on an older version, so I didn't see that available.

But, is there a way to enforce a naming convention for the Project Key? I'm now fine with the Project Name being descriptive, but I need to enforce a naming convention on the Project Key.

Mary

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

scaling agile at the enterprise level with Valiantys

Hey there Community! My name is Vannya Vallejo, the Channel Communication Specialist at Atlassian and I want to help Atlassian users like you learn about our Solution Partners and how they can help ...

427 views 1 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you