Skip to content

Instantly share code, notes, and snippets.

@jameshd
Created March 22, 2016 15:09
Show Gist options
  • Save jameshd/72d995da18c65ed1be97 to your computer and use it in GitHub Desktop.
Save jameshd/72d995da18c65ed1be97 to your computer and use it in GitHub Desktop.
JIRA Ticket Pre Commit Hook
#!/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