From eaf5acdb7fb7e9116a1a2da66e65015390648ad9 Mon Sep 17 00:00:00 2001 From: Mohan Raj Rajamanickam <1509984+mohanraj-r@users.noreply.github.com> Date: Wed, 8 Apr 2026 04:38:20 -0700 Subject: [PATCH] ci: fail PR if title does not match Conventional Commits format @W-21613569@ [post-tdx] (#146) add pr title check Co-authored-by: Hemant Singh Bisht --- .github/workflows/validate-pr.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 2d267f5..3e2145e 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -8,3 +8,28 @@ on: jobs: pr-title: uses: salesforcecli/github-workflows/.github/workflows/validatePR.yml@main + + conventional-commit-title: + name: Validate Conventional Commit Title + runs-on: ubuntu-latest + steps: + - name: Check PR title format + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + if ! echo "$PR_TITLE" | grep -qP '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([^)]+\))?(!)?: .+$'; then + echo "PR title does not match Conventional Commits format." + echo "" + echo "Expected: (): " + echo " Types: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test" + echo " Breaking change: append '!' before the colon" + echo "" + echo "Examples:" + echo " feat(auth): add OAuth2 support" + echo " fix: resolve null pointer in parser" + echo " feat!: drop support for Node 14" + echo "" + echo "Got: $PR_TITLE" + exit 1 + fi + echo "PR title matches Conventional Commits format."