Skip to content

Instantly share code, notes, and snippets.

@madhukar93
Created July 26, 2018 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madhukar93/a929e24ad59d192ae9a470423b1eb8b1 to your computer and use it in GitHub Desktop.
Save madhukar93/a929e24ad59d192ae9a470423b1eb8b1 to your computer and use it in GitHub Desktop.
branch name should contain issue type and issue ID
def check_branch_name = { name ->
jira_issue_re = /.*\(((?<!([A-Z]{1,10})-?)[A-Z]+-\d+)\)$/ // any chars followed by jira issue ID at the end
pr_type_re = /^(?i)(bugfix|enhancement|feature|hotfix)-.*/ // pr type followed by any chars
name =~ jira_issue_re && name =~ pr_type_re
}
check_branch_name "BGfix-hello world-(CN-85)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment