-
Notifications
You must be signed in to change notification settings - Fork 2
41 lines (34 loc) · 1.17 KB
/
commitlint.yml
File metadata and controls
41 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Commitlint
on:
pull_request:
branches: [main]
permissions:
contents: read
jobs:
validate-commits:
name: Validate commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: "22"
- run: npm install
- name: Validate PR commits
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
validate-branch-name:
name: Validate branch name
runs-on: ubuntu-latest
steps:
- name: Check branch name
run: |
BRANCH="${{ github.head_ref }}"
PATTERN="^(feat|fix|docs|refactor|test|chore|ci|perf|build|release|dependabot|revert|benchmark)/"
if [[ ! "$BRANCH" =~ $PATTERN ]]; then
echo "::error::Branch name '$BRANCH' does not match the required pattern."
echo "Branch names must start with one of: feat/, fix/, docs/, refactor/, test/, chore/, ci/, perf/, build/, release/, dependabot/, revert/, benchmark/"
exit 1
fi
echo "Branch name '$BRANCH' is valid."