feat(dev-infra): allow local ng-dev configuration to error on invalid commit messages (#38784)
As part of the commit message conformance check, local commit message checks are made to be warnings rather than failures. An additional local option is also in place to allow for the commit message validation failures to be considered errors instead. PR Close #38784
This commit is contained in:

committed by
Andrew Kushnir

parent
f52a494248
commit
26deef2d3e
@ -6,6 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import * as yargs from 'yargs';
|
||||
import {getUserConfig} from '../utils/config';
|
||||
|
||||
import {info} from '../utils/console';
|
||||
|
||||
@ -78,11 +79,17 @@ export function buildCommitMessageParser(localYargs: yargs.Argv) {
|
||||
}
|
||||
return file;
|
||||
},
|
||||
},
|
||||
'error': {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'Whether invalid commit messages should be treated as failures rather than a warning',
|
||||
default: !!getUserConfig().commitMessage?.errorOnInvalidMessage || !!process.env['CI']
|
||||
}
|
||||
},
|
||||
args => {
|
||||
const file = args.file || args['file-env-variable'] || '.git/COMMIT_EDITMSG';
|
||||
validateFile(file);
|
||||
validateFile(file, args.error);
|
||||
})
|
||||
.command(
|
||||
'validate-range', 'Validate a range of commit messages', {
|
||||
|
Reference in New Issue
Block a user