chore(repo): fix the regex to validate commits (#31630)
## Current Behavior The string regex the script uses to validate commits is not correctly escaped. ## Expected Behavior The string regex the script uses to validate commits should be correctly escaped.
This commit is contained in:
parent
db6e0d1217
commit
1a9405b0bc
@ -43,7 +43,7 @@ if (!gitMessage) {
|
|||||||
const allowedTypes = types.map((type) => type.value).join('|');
|
const allowedTypes = types.map((type) => type.value).join('|');
|
||||||
const allowedScopes = scopes.map((scope) => scope.value).join('|');
|
const allowedScopes = scopes.map((scope) => scope.value).join('|');
|
||||||
|
|
||||||
const commitMsgRegex = `(${allowedTypes})\\((${allowedScopes})\\)!?:\\s(([a-z0-9:\-\s])+)`;
|
const commitMsgRegex = `(${allowedTypes})\\((${allowedScopes})\\)!?:\\s(([a-z0-9:\\-\\s])+)`;
|
||||||
|
|
||||||
const matchCommit = new RegExp(commitMsgRegex, 'g').test(gitMessage);
|
const matchCommit = new RegExp(commitMsgRegex, 'g').test(gitMessage);
|
||||||
const matchRevert = /Revert/gi.test(gitMessage);
|
const matchRevert = /Revert/gi.test(gitMessage);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user