-
-
Save pulkitsinghal/f9c6eac2329604d45e3c to your computer and use it in GitHub Desktop.
Git hook that checks if you reference an issue in your commit
This file contains hidden or 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 = /issues?\s+#(\d+)/ | |
if !$regex.match(message) | |
puts "[POLICY] Please reference an issue in your commit." | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested on rubular.com with sample inputs: