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.
Hi Vignesh, welcome to the Community!
Are you using Scriptrunner? There was a similar request here, I recommend reading through it as there are several options that might help you.
Alternatively, let us know which plugin are you using (if any) so we can continue helping you.
Kind regards,
Ana
Hi Ana,
Thanks for the information!! I am not using any scriptrunner.
In my forked repository, under pre-hooks, I enabled Require commits to be associated with a JIRA issue pre-hook. I have provided the regex and JQL clause as shown below.
Now, I have to add a condition in the condition Tab.
The condition should be like :
1. The commit message should start with ABC8CC followed by hyphen- then followed by numbers(regex check)
2. If the commit message does not start with ABC8CC ,then it should not allow to commit.
It would be great if you can provide me with the condition. Thanks in Advance and Sorry for my late response.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The link provided is about forbidding PR get merged without commit ID.
I need a pre-hook which does not allow to commit if the regex is not matched.
Please let me know if there is any detail needed from my side
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.