I'm working on setting up a ScriptRunner pre-hook in Bitbucket to enforce specific branch naming conventions that correlate with JIRA issue types. Specifically, I want to ensure that any new branch created from a task in JIRA doesn't contain a certain string ("abc") in its name. I've looked through the ScriptRunner and Bitbucket documentation but haven't found clear guidance on how to achieve this.
Here's what I'm trying to accomplish:
Branch Naming Convention: The branch name should include a JIRA issue key (e.g., "TASK-123") and NOT a specific string ("abc"). For example, "feature/TASK-123-abc-description".
Pre-Hook Requirement: Before a branch is pushed to Bitbucket, the pre-hook should:
Verify that the branch is associated with a JIRA issue of type "Task".
Check that the branch name doesn't contain the string "abc".
I have no idea how to check for the issue type. Branch name is easy to evaluate but how u evaluate a issuetype from which the branch was created
We are using: Atlassian Bitbucket v7.21.21