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


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?



2 answers

1 accepted

0 votes
Answer accepted
adammarkham 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.

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



0 votes
adammarkham 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!

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.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Marketplace Spotlight: November Continuous Integrations

                                                Shipping new code shoul...

67 views 0 1
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