I would like to customize my repository so that if I commit anything without the issue number(JIRA ID), it should not allow me to .
Is there any way to do it using pre hooks?
I see a pre-hook named "Require commits to be associated with a JIRA issue" but I dont know what condition to provide in condition pane.
What we are looking for is: The commit should not be allowed if the regex does not match
Except conditions, I have filled all other fields (JQL Query and regex).
Regex which I created follows the below condition:
Commit should start with
1. alpha numeric upper case - min 2 char (for example for ABC)
2. hyphen Mandatory
3. Number (0-9) - At least 1 digit
4. No spaces around hyphen.
5. Space required after jira story number. And at least 1 word comment afterward.
ex. ABC-1234 Adding some changes
Could anyone please provide me with the correct condition? Thanks in advance.