You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hello Adaptavist, Atlassian,
I have setup Script Event Handlers and Script Pre Hooks 'Naming standard enforcement' for bugfix and hotfix as per below in Bamboo Server Scriptrunner add-on
Now what we need next is a condition in Pre Hooks or Event Handlers to compare in between commit message JIRA Issue number with the branch JIRA Issue number when there is commits occur.
The idea is that
Branch: " bugfix/DEMO-123 Fixing issue xxxx"
Git commit message: " DEMO-123 New commits"
As such, do I need to use "Pre-receive Hooks -> Require commits to be associated with a JIRA issue" ? If so appreciate if you can provide the condition/script that I need to use to archive this.
Thank you in advance.
I was hoping to see an answer here because our problem is similar. We are using the built-in pre-receive hook to to Require commits to be associated with a JIRA issue and it will succeed if it finds a matching Jira issueID in either the commit or in the branch name. The problem: if the developer created the branch with the correct Jira issue ID mentioned, they are able to commit without any valid issue ID mentioned at all. Once the pull request is merged and the branch is deleted, the Jira tracability for these commits is lost. We're hoping there's a way to either force the hook to only look at the commit messages and not at the branch name or else to do what's mentioned here: require the issue ID to be mentioned in both the branch name and the corresponding commits.