From 13c1839f3cab9df812e0acf1fc21e0880737d866 Mon Sep 17 00:00:00 2001 From: AnegasakiNene <990126341@qq.com> Date: Mon, 8 Jun 2026 12:12:58 +0800 Subject: [PATCH 1/2] feat(ci): allow conventional PR title prefixes --- .github/workflows/pr-title-check.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index c7d6024b61..e5178e8d15 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -18,10 +18,12 @@ jobs: with: script: | const title = (context.payload.pull_request.title || "").trim(); - // allow only: + // Allow Conventional Commit style PR titles. + // Examples: // feat: xxx - // feat(scope): xxx - const pattern = /^(feat)(\([a-z0-9-]+\))?:\s.+$/i; + // fix(scope): xxx + const allowedTypes = "feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert"; + const pattern = new RegExp(`^(${allowedTypes})(\\([a-z0-9-]+\\))?:\\s.+$`, "i"); const isValid = pattern.test(title); const isSameRepo = context.payload.pull_request.head.repo.full_name === context.payload.repository.full_name; @@ -37,7 +39,11 @@ jobs: "⚠️ PR title format check failed.", "Required formats:", "- `feat: xxx`", - "- `feat(scope): xxx`", + "- `fix(scope): xxx`", + "- `chore: xxx`", + "", + "Allowed prefixes:", + "`feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `ci`, `build`, `revert`", "Please update your PR title and push again." ].join("\n") }); @@ -50,5 +56,5 @@ jobs: } if (!isValid) { - core.setFailed("Invalid PR title. Expected format: feat: xxx or feat(scope): xxx."); + core.setFailed("Invalid PR title. Expected Conventional Commit format, e.g. feat: xxx or fix(scope): xxx."); } From acdb29ad99c410843749ff0bcd8c3e850ee17ee2 Mon Sep 17 00:00:00 2001 From: AnegasakiNene <990126341@qq.com> Date: Mon, 8 Jun 2026 13:27:55 +0800 Subject: [PATCH 2/2] fix(ci): clarify PR title examples --- .github/workflows/pr-title-check.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index e5178e8d15..e8bb3883ec 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -21,6 +21,8 @@ jobs: // Allow Conventional Commit style PR titles. // Examples: // feat: xxx + // feat(scope): xxx + // fix: xxx // fix(scope): xxx const allowedTypes = "feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert"; const pattern = new RegExp(`^(${allowedTypes})(\\([a-z0-9-]+\\))?:\\s.+$`, "i"); @@ -39,6 +41,8 @@ jobs: "⚠️ PR title format check failed.", "Required formats:", "- `feat: xxx`", + "- `feat(scope): xxx`", + "- `fix: xxx`", "- `fix(scope): xxx`", "- `chore: xxx`", "", @@ -56,5 +60,5 @@ jobs: } if (!isValid) { - core.setFailed("Invalid PR title. Expected Conventional Commit format, e.g. feat: xxx or fix(scope): xxx."); + core.setFailed("Invalid PR title. Expected Conventional Commit format, e.g. feat: xxx, feat(scope): xxx, or fix: xxx."); }