chore: refine PR title format and update validation regex for optional scope

This commit is contained in:
Victor Santos
2025-11-28 10:07:23 -03:00
parent 60daa12d21
commit 793e995f57
2 changed files with 9 additions and 11 deletions

View File

@@ -6,9 +6,7 @@
<!-- If UI/UX changes, add screenshots or videos. Delete if not applicable. --> <!-- If UI/UX changes, add screenshots or videos. Delete if not applicable. -->
## How to test ## Steps to verify the change
<!-- Steps to verify the change. -->
## Type ## Type
@@ -21,7 +19,7 @@
## Checklist ## Checklist
- [ ] Title follows format: `type[scope]: Short description` (scope is optional, e.g., `fix: Prevent crash on sync` or `fix[api]: Handle null response`) - [ ] Title follows format: `type(scope): Short description` (scope is optional, e.g., `fix: Prevent crash on sync` or `fix(api): Handle null response`)
- [ ] Tested locally - [ ] Tested locally
- [ ] Updated docs (if needed) - [ ] Updated docs (if needed)
- [ ] Read the [contributing guide](https://infisical.com/docs/contributing/getting-started/overview) - [ ] Read the [contributing guide](https://infisical.com/docs/contributing/getting-started/overview)

View File

@@ -18,11 +18,11 @@ jobs:
// Valid PR types based on pull_request_template.md // Valid PR types based on pull_request_template.md
const validTypes = ['fix', 'feature', 'improvement', 'breaking', 'docs', 'chore']; const validTypes = ['fix', 'feature', 'improvement', 'breaking', 'docs', 'chore'];
// Regex pattern: type[optional-scope]: Short description // Regex pattern: type(optional-scope): Short description
// - Type must be one of the valid types // - Type must be one of the valid types
// - Scope is optional, must be in brackets, lowercase alphanumeric with hyphens // - Scope is optional, must be in parentheses, lowercase alphanumeric with hyphens
// - Followed by colon, space, and description // - Followed by colon, space, and description
const pattern = new RegExp(`^(${validTypes.join('|')})(\\[[a-z0-9-]+\\])?: .+$`); const pattern = new RegExp(`^(${validTypes.join('|')})(\\([a-z0-9-]+\\))?: .+$`);
if (!pattern.test(title)) { if (!pattern.test(title)) {
const errorMessage = ` const errorMessage = `
@@ -30,7 +30,7 @@ jobs:
Your PR title: \`${title}\` Your PR title: \`${title}\`
**Expected format:** \`type[scope]: Short description\` **Expected format:** \`type(scope): Short description\`
**Valid types:** **Valid types:**
- \`fix\` - Bug fixes - \`fix\` - Bug fixes
@@ -40,12 +40,12 @@ jobs:
- \`docs\` - Documentation updates - \`docs\` - Documentation updates
- \`chore\` - Maintenance tasks - \`chore\` - Maintenance tasks
**Scope:** Optional, short identifier in brackets (e.g., \`[api]\`, \`[auth]\`, \`[ui]\`) **Scope:** Optional, short identifier in parentheses (e.g., \`(api)\`, \`(auth)\`, \`(ui)\`)
**Examples:** **Examples:**
- \`fix: Prevent crash on sync\` - \`fix: Prevent crash on sync\`
- \`fix[api]: Handle null response from auth endpoint\` - \`fix(api): Handle null response from auth endpoint\`
- \`docs[cli]: Update installation guide\` - \`docs(cli): Update installation guide\`
`; `;
core.setFailed(errorMessage); core.setFailed(errorMessage);