feat(dev-infra): create commit-message validation script/tooling (#36117)
PR Close #36117
This commit is contained in:

committed by
Misko Hevery

parent
989dea7083
commit
6fc85073d2
@ -6,7 +6,11 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {readFileSync} from 'fs';
|
||||
import {join} from 'path';
|
||||
import {verify} from './pullapprove/verify';
|
||||
import {validateCommitMessage} from './commit-message/validate';
|
||||
import {getRepoBaseDir} from './utils/config';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
@ -16,6 +20,12 @@ switch (args[0]) {
|
||||
case 'pullapprove:verify':
|
||||
verify();
|
||||
break;
|
||||
case 'commit-message:pre-commit-validate':
|
||||
const commitMessage = readFileSync(join(getRepoBaseDir(), '.git/COMMIT_EDITMSG'), 'utf8');
|
||||
if (validateCommitMessage(commitMessage)) {
|
||||
console.info('√ Valid commit message');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.info('No commands were matched');
|
||||
}
|
||||
|
Reference in New Issue
Block a user