Skip to content

Commit c74bc32

Browse files
committed
ci: tweak enforcement of titles
1 parent c7b825a commit c74bc32

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

.github/workflows/pr-standards.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,23 @@ jobs:
7070
}
7171
7272
// Step 1: Check title format
73-
const validPrefixes = ['feat:', 'fix:', 'docs:', 'chore:', 'refactor:', 'test:'];
74-
const hasValidTitle = validPrefixes.some(prefix => title.startsWith(prefix));
73+
// Matches: feat:, feat(scope):, feat (scope):, etc.
74+
const titlePattern = /^(feat|fix|docs|chore|refactor|test)\s*(\([a-zA-Z0-9-]+\))?\s*:/;
75+
const hasValidTitle = titlePattern.test(title);
7576
7677
if (!hasValidTitle) {
7778
await addLabel('needs:title');
7879
await comment('title', `Hey! Your PR title \`${title}\` doesn't follow conventional commit format.
7980
8081
Please update it to start with one of:
81-
- \`feat:\` new feature
82-
- \`fix:\` bug fix
83-
- \`docs:\` documentation changes
84-
- \`chore:\` maintenance tasks
85-
- \`refactor:\` code refactoring
86-
- \`test:\` adding or updating tests
82+
- \`feat:\` or \`feat(scope):\` new feature
83+
- \`fix:\` or \`fix(scope):\` bug fix
84+
- \`docs:\` or \`docs(scope):\` documentation changes
85+
- \`chore:\` or \`chore(scope):\` maintenance tasks
86+
- \`refactor:\` or \`refactor(scope):\` code refactoring
87+
- \`test:\` or \`test(scope):\` adding or updating tests
88+
89+
Where \`scope\` is the package name (e.g., \`app\`, \`desktop\`, \`opencode\`).
8790
8891
See [CONTRIBUTING.md](../blob/dev/CONTRIBUTING.md#pr-titles) for details.`);
8992
return;
@@ -92,7 +95,7 @@ jobs:
9295
await removeLabel('needs:title');
9396
9497
// Step 2: Check for linked issue (skip for docs/refactor PRs)
95-
const skipIssueCheck = title.startsWith('docs:') || title.startsWith('refactor:');
98+
const skipIssueCheck = /^(docs|refactor)\s*(\([a-zA-Z0-9-]+\))?\s*:/.test(title);
9699
if (skipIssueCheck) {
97100
await removeLabel('needs:issue');
98101
console.log('Skipping issue check for docs/refactor PR');

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,19 @@ PR titles should follow conventional commit standards:
192192
- `refactor:` code refactoring without changing behavior
193193
- `test:` adding or updating tests
194194

195+
You can optionally include a scope to indicate which package is affected:
196+
197+
- `feat(app):` feature in the app package
198+
- `fix(desktop):` bug fix in the desktop package
199+
- `chore(opencode):` maintenance in the opencode package
200+
195201
Examples:
196202

197203
- `docs: update contributing guidelines`
198204
- `fix: resolve crash on startup`
199205
- `feat: add dark mode support`
206+
- `feat(app): add dark mode support`
207+
- `fix(desktop): resolve crash on startup`
200208
- `chore: bump dependency versions`
201209

202210
### Style Preferences

0 commit comments

Comments
 (0)