diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml new file mode 100644 index 0000000..d3db41f --- /dev/null +++ b/.github/workflows/pr-title-check.yml @@ -0,0 +1,28 @@ +name: PR Title Check + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +jobs: + check-title: + runs-on: ubuntu-latest + steps: + - name: Check PR title follows conventional commits + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + PATTERN='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?(!)?: .{1,}' + if [[ ! "$PR_TITLE" =~ $PATTERN ]]; then + echo "::error::PR title does not follow conventional commits format." + echo "" + echo "Expected: (): " + echo "Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert" + echo "" + echo "Examples:" + echo " feat: add new routing recipe" + echo " fix(implement): correct config-plumbing verify step" + echo " docs: update README with install instructions" + exit 1 + fi + echo "PR title is valid: $PR_TITLE"