e9f82b0ee3
Follow-up to #37498, adds `chore` to the allowed PR title types so the set matches the standard [`@commitlint/config-conventional`](https://github.com/conventional-changelog/commitlint/tree/868983c18efcb6fa835197cc9b2275545e528ad4/%40commitlint/config-conventional#type-enum). --- This PR was written with the help of Claude Opus 4.7 --------- Signed-off-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
20 lines
566 B
JavaScript
20 lines
566 B
JavaScript
#!/usr/bin/env node
|
|
import {env, exit} from 'node:process';
|
|
|
|
const allowedTypes = 'build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test';
|
|
const title = env.PR_TITLE;
|
|
|
|
if (!title) {
|
|
console.error('Missing PR_TITLE');
|
|
exit(1);
|
|
}
|
|
|
|
const validTitlePattern = new RegExp(`^(${allowedTypes.replaceAll(', ', '|')})(\\([\\w.-]+\\))?(!)?: .+$`);
|
|
|
|
if (!validTitlePattern.test(title)) {
|
|
console.error(`Invalid PR title: ${title}`);
|
|
console.error('Expected format: type(scope): subject');
|
|
console.error(`Allowed types: ${allowedTypes}`);
|
|
exit(1);
|
|
}
|