Go to Datree's "custom rules" tab and click on "create new rule" button
1. Choose custom rule type
Step 1 at the wizard - choose "custom commit message"
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
3. Configure your custom rule
- Regular Expression - which pattern should be validated for the commit message
βΉοΈ The following regular expression will verify that every commit messages starts with a capital letter and must be between 5-50 characters
^[A-Z].{4,49} $
Regular Expression | Explanation |
---|---|
^ | Assert position at the beginning of the string |
[A-Z] | Match one letter from A to Z |
. | Match any character |
{4,49} | Between 4 and 49 times |
$ | Assert position at the end of the string |
-
Match all commits - will all the commits messages in the pull request needs to follow the given regex pattern?
-
Ignore merge commits - ignore auto-created commits by GitHub when merging a pull request?
- Test Text - an input box to test your regex π
4. Wrap it up
Click on the "create" button to add your custom policy to the policies menu on the left
By default, the rule will not be enabled until explicitly defining repositories