Last active
September 15, 2018 15:04
-
-
Save Createdd/437ac97100c4c0ee0a6b2e077c65ca25 to your computer and use it in GitHub Desktop.
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 node | |
| const fs = require( 'fs' ); | |
| const commit = process.argv[2]; | |
| const data = fs.readFileSync( commit, { encoding: 'utf8' } ); | |
| const [ firstLine ] = data.split( '\n' ); | |
| const result = /^[A-Z]+\-\d+ .+$/.test( firstLine ); | |
| const errorMessage = ` | |
| ----------------------------------------------------- | |
| Commit message does not comply to format standards! | |
| Please use the following msg format: | |
| 'example' | |
| ----------------------------------------------------- | |
| `; | |
| if ( !result ) { | |
| console.log(errorMessage); | |
| process.exit(1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment