Created
March 22, 2016 15:09
-
-
Save jameshd/72d995da18c65ed1be97 to your computer and use it in GitHub Desktop.
JIRA Ticket Pre Commit Hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
message_file = ARGV[0] | |
message = File.read(message_file); | |
regex = /([A-Z]{1,3}-\d{1,})/ | |
if !message.start_with?('Merge') && !regex.match(message) | |
puts "Your commit message does not contain a JIRA ticket reference" | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment