Skip to content

Instantly share code, notes, and snippets.

@atroche
Last active August 6, 2020 02:33
Show Gist options
  • Save atroche/cc795746e4cfff3f9d1bd2ea0f684390 to your computer and use it in GitHub Desktop.
Save atroche/cc795746e4cfff3f9d1bd2ea0f684390 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import re, sys, os
def main():
# example:
# feat(apikey): added the ability to add api key to configuration
pattern = r'(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\([\w\-]+\))?:\s.*'
filename = sys.argv[1]
ss = open(filename, 'r').read()
m = re.match(pattern, ss)
if m == None: raise Exception("conventional commit validation failed")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment