Skip to content

Commit 2642f87

Browse files
author
shuni[bot]
committed
ci: enforce semantic commit conventions for releases
1 parent 6164955 commit 2642f87

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

.commitlintrc.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
extends:
2+
- '@commitlint/config-conventional'
3+
4+
rules:
5+
type-enum:
6+
- 2
7+
- always
8+
- - feat
9+
- fix
10+
- docs
11+
- style
12+
- refactor
13+
- perf
14+
- test
15+
- build
16+
- ci
17+
- chore
18+
- revert
19+
subject-case:
20+
- 2
21+
- never
22+
- - upper-case
23+
- pascal-case
24+
- start-case
25+
subject-empty:
26+
- 2
27+
- never
28+
type-empty:
29+
- 2
30+
- never
31+
scope-case:
32+
- 2
33+
- always
34+
- lower-case

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,39 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16+
validate-pr-title:
17+
name: Validate PR Title
18+
if: github.event_name == 'pull_request'
19+
runs-on: ubuntu-latest
20+
permissions:
21+
pull-requests: read
22+
steps:
23+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
types: |
28+
feat
29+
fix
30+
docs
31+
style
32+
refactor
33+
perf
34+
test
35+
build
36+
ci
37+
chore
38+
revert
39+
requireScope: false
40+
subjectPattern: ^(?![A-Z]).+$
41+
subjectPatternError: |
42+
The subject "{subject}" found in the pull request title "{title}"
43+
didn't match the configured pattern. Please ensure that the subject
44+
doesn't start with an uppercase character.
45+
wip: false
46+
validateSingleCommit: false
47+
validateSingleCommitMatchesPrTitle: false
48+
1649
build:
1750
name: test with ${{ matrix.py }} on ${{ matrix.os }}
1851
runs-on: ${{ matrix.os }}

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ repos:
5858
rev: v8.30.0
5959
hooks:
6060
- id: gitleaks
61+
- repo: https://github.com/compilerla/conventional-pre-commit
62+
rev: v3.6.0
63+
hooks:
64+
- id: conventional-pre-commit
65+
stages: [commit-msg]
66+
args: [--strict]
6167
- repo: local
6268
hooks:
6369
- id: print_statement

0 commit comments

Comments
 (0)