Skip to content

Commit ef2e01c

Browse files
authored
ci: add conventional commit pr title enforcement (#413)
1 parent 48cb4ab commit ef2e01c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ permissions:
1414
contents: read
1515

1616
jobs:
17+
conventional-pr-title:
18+
if: github.event_name == 'pull_request'
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Validate pull request title
23+
env:
24+
PR_TITLE: ${{ github.event.pull_request.title }}
25+
run: |
26+
pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([[:alnum:]_.-]+\))?(!)?: .+$'
27+
28+
if [[ ! "$PR_TITLE" =~ $pattern ]]; then
29+
echo "PR title must follow Conventional Commits, for example: feat(ui): add route summary"
30+
echo "Got: $PR_TITLE"
31+
exit 1
32+
fi
33+
1734
lint-and-test:
1835
runs-on: ubuntu-latest
1936

0 commit comments

Comments
 (0)