Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create branch in Bitbucket action in automation raises "Branch name can't contain ' '"

mostafa_gado August 4, 2022

Hi, I'm automating bitbucket branch creation on issue creation using "Create branch in Bitbucket" action. In the branch name I wanted to reference the issue key and summary so I used Jira smart values in the branch name field: issue.key-issue.summary.

When testing I get this error:

Error trying to create branch:
EE-4-front issue auto test (Branch name can't contain ' ')

 I think this is because the issue summary contains spaces. This is fixed when creating the branch from the issue directly using the "create branch" button. Jira replaces the spaces in the issue summary with dashes '-'. But in automation this doesn't happen.

So is this a bug or is there a way to do this somehow?

Thanks

2 answers

1 accepted

3 votes
Answer accepted
mostafa_gado August 4, 2022

I found the solution. To replace the spaces with dashes in the issue summary using Smart Values this did it: 

{{issue.summary.replace(" ", "-")}}

0 votes
Eugenio Onofre
Community Champion
August 4, 2022

Hello @mostafa_gado
Welcome to the Atlassian Community!

I assume you are using Smart Values on the automation. If this is the case, you can use the JSON functions described at https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/

The function asJsonString should help you resolve it.

Regards,
Eugenio

mostafa_gado August 4, 2022

Thanks for the reply. Unfortunately the asJsonString doesn't remove spaces. Only special characters I think as stated in the doc.

Eugenio Onofre
Community Champion
August 4, 2022

Glad to see you found the solution.

Like mostafa_gado likes this

Suggest an answer

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

Atlassian Community Events