File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env node
2+ import * as ChildProcess from 'node:child_process' ;
3+ import * as process from 'node:process' ;
4+ import * as dotenv from 'dotenv' ;
5+
6+ dotenv . config ( ) ;
7+
8+ const checkCommitMail = ( ) => {
9+ console . warn ( `Check COMMIT_MAIL` ) ;
10+ if ( ! process . env . COMMIT_MAIL ) {
11+ console . error (
12+ `No COMMIT_MAIL set in .env, please take a look at the file '.env.template'`
13+ ) ;
14+ process . exit ( 1 ) ;
15+ }
16+
17+ const currentMail = ChildProcess . execSync ( 'git config user.email' )
18+ . toString ( )
19+ . trim ( )
20+ . toLowerCase ( ) ;
21+ const commitMail = process . env . COMMIT_MAIL . trim ( ) . toLowerCase ( ) ;
22+ if ( currentMail !== commitMail ) {
23+ console . error (
24+ `currentMail: ${ currentMail } !== initialMail: ${ commitMail } `
25+ ) ;
26+ console . error (
27+ `Please set your commit user mail for this project like: 'git config user.email '${ commitMail } ''`
28+ ) ;
29+ process . exit ( 1 ) ;
30+ }
31+ } ;
32+
33+ checkCommitMail ( ) ;
You can’t perform that action at this time.
0 commit comments