Branch name
  • Updated on 22 Apr 2019
  • 1 minute to read
  • Contributors
  • Share
  • Dark
    Light

Branch name

  • Share
  • Dark
    Light

Go to Datree's "custom rules" tab and click on "create new rule" button

3x-7d2fdb6-1.png

1. Choose custom rule type

Step 1 at the wizard - choose "custom branch name"

9880a6f-Screen_Shot_2019-04-15_at_14.21.49

2. Edit custom rule details

The rule description will be shown on the custom rule dashboard, while the rule title will be used on GitHub "smart policy" check

2da19f6-Screen_Shot_2019-04-15_at_14.24.59

3. Configure your custom rule

  • Regular Expression - which pattern should be validated for the branch name

77262db-Screen_Shot_2019-04-15_at_14.28.15

ℹ️ The following regular expression will verify every branch mention a Jira issue ticket at the beginning of the branch name

((?!([A-Z0-9a-z]{1,10})-?$)[A-Z]{1}[A-Z0-9]+-\d+).+

4. Wrap it up

Click on the "create" button to add your custom policy to the policies menu on the left.

10e70e3-Screen_Shot_2019-04-15_at_14.33.49

By default, the rule will not be enabled until explicitly defining repositories

5. See your custom policy in action!

Branch name will NOT pass the policy:

47825cc-Screen_Shot_2019-04-15_at_14.37.28

After fixing the branch name:

71005dc-Screen_Shot_2019-04-15_at_14.41.52

Was this article helpful?