From 793e995f57c51a8450a26ed69966cabb7d074b34 Mon Sep 17 00:00:00 2001 From: Victor Santos Date: Fri, 28 Nov 2025 10:07:23 -0300 Subject: [PATCH] chore: refine PR title format and update validation regex for optional scope --- .github/pull_request_template.md | 6 ++---- .github/workflows/validate-pr-title.yml | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index afd0f1b57..bec62f0bc 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,9 +6,7 @@ -## How to test - - +## Steps to verify the change ## Type @@ -21,7 +19,7 @@ ## 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 - [ ] Updated docs (if needed) - [ ] Read the [contributing guide](https://infisical.com/docs/contributing/getting-started/overview) \ No newline at end of file diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml index d7bfe6043..650690329 100644 --- a/.github/workflows/validate-pr-title.yml +++ b/.github/workflows/validate-pr-title.yml @@ -18,11 +18,11 @@ jobs: // Valid PR types based on pull_request_template.md 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 - // - 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 - const pattern = new RegExp(`^(${validTypes.join('|')})(\\[[a-z0-9-]+\\])?: .+$`); + const pattern = new RegExp(`^(${validTypes.join('|')})(\\([a-z0-9-]+\\))?: .+$`); if (!pattern.test(title)) { const errorMessage = ` @@ -30,7 +30,7 @@ jobs: Your PR title: \`${title}\` - **Expected format:** \`type[scope]: Short description\` + **Expected format:** \`type(scope): Short description\` **Valid types:** - \`fix\` - Bug fixes @@ -40,12 +40,12 @@ jobs: - \`docs\` - Documentation updates - \`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:** - \`fix: Prevent crash on sync\` - - \`fix[api]: Handle null response from auth endpoint\` - - \`docs[cli]: Update installation guide\` + - \`fix(api): Handle null response from auth endpoint\` + - \`docs(cli): Update installation guide\` `; core.setFailed(errorMessage);