update pr title spec to match current style

This commit is contained in:
Dmitriy 2024-06-09 21:59:30 -04:00
parent 2a3535c6aa
commit 269bdb0e98

View File

@ -34,17 +34,17 @@ async function run() {
const info = ` const info = `
Terminology: fix(ui): Fix female trainer names Terminology: [bug(ui)]: Fix female trainer names
^ ^ ^ ^ ^ ^
| | |__ Subject | | |__ Subject
| |_______ Scope | |________ Scope
|___________ Prefix |____________ Prefix
`; `;
core.info(info.trim()); core.info(info.trim());
// Check if title pass regex // Check if title pass regex
const regex = RegExp(/^[a-zA-Z]+(\([a-zA-Z]+\))?: .+/); const regex = RegExp(/^\[[a-zA-Z]+(\([a-zA-Z]+\))?\]: .+/);
if (!regex.test(title)) { if (!regex.test(title)) {
core.setFailed(`Pull Request title "${title}" failed to match - 'Prefix(Scope): Subject'`); core.setFailed(`Pull Request title "${title}" failed to match - 'Prefix(Scope): Subject'`);
return; return;
@ -52,7 +52,7 @@ Terminology: fix(ui): Fix female trainer names
// Check if title starts with an allowed prefix // Check if title starts with an allowed prefix
core.info(`Allowed prefixes: ${PREFIXES}`); core.info(`Allowed prefixes: ${PREFIXES}`);
if (!PREFIXES.some((prefix) => title.startsWith(prefix))) { if (!PREFIXES.some((prefix) => title.toLowerCase().startsWith(prefix))) {
core.setFailed(`Pull Request title "${title}" did not match any of the prefixes - ${PREFIXES}`); core.setFailed(`Pull Request title "${title}" did not match any of the prefixes - ${PREFIXES}`);
return; return;
} }