mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-19 03:21:05 +00:00
Follow-up to #37498, adds `chore` to the allowed PR title types so the
set matches the standard
[`@commitlint/config-conventional`](868983c18e/%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);
|
|
}
|