Skip to content

Commit 35a81e7

Browse files
committed
fix: Use commitlint pre-commit hook instead of a separate action
Signed-off-by: ntkathole <nikhilkathole2683@gmail.com>
1 parent 547b516 commit 35a81e7

File tree

6 files changed

+1609
-9
lines changed

6 files changed

+1609
-9
lines changed

.commitlintrc.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
extends:
2+
- "@commitlint/config-conventional"
3+
4+
# Single source of truth for commit/PR title conventions.
5+
# Used by:
6+
# - .pre-commit-config.yaml (commitlint hook on commit-msg)
7+
# - .github/workflows/lint_pr.yml (validates PR titles in CI)
8+
rules:
9+
type-enum:
10+
- 2
11+
- always
12+
- - feat
13+
- fix
14+
- docs
15+
- style
16+
- refactor
17+
- perf
18+
- test
19+
- build
20+
- ci
21+
- chore
22+
- revert
23+
24+
# Scope is optional — no enforcement on allowed values.
25+
scope-empty:
26+
- 0
27+
28+
# Feast convention: subjects start with an uppercase letter.
29+
# Overrides base config which defaults to "never sentence-case".
30+
subject-case:
31+
- 2
32+
- always
33+
- - sentence-case
34+
35+
header-max-length:
36+
- 2
37+
- always
38+
- 100
39+
40+
# Relax body/footer line length from base config's strict 100-char limit.
41+
# Commit bodies often contain URLs, stack traces, or formatted output.
42+
body-max-line-length:
43+
- 0
44+
footer-max-line-length:
45+
- 0

.github/workflows/lint_pr.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
name: Validate PR title
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: amannn/action-semantic-pull-request@v5
17+
- uses: actions/checkout@v4
1818
with:
19-
# Must use uppercase
20-
subjectPattern: ^(?=[A-Z]).+$
21-
subjectPatternError: |
22-
The subject "{subject}" found in the pull request title "{title}"
23-
didn't match the configured pattern. Please ensure that the subject
24-
starts with an uppercase character.
19+
sparse-checkout: .commitlintrc.yaml
20+
sparse-checkout-cone-mode: false
21+
- name: Lint PR title with commitlint
2522
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
PR_TITLE: ${{ github.event.pull_request.title }}
24+
run: |
25+
npm install --no-save @commitlint/cli @commitlint/config-conventional
26+
echo "$PR_TITLE" | npx commitlint

.github/workflows/linter.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
make install-python-dependencies-ci
25+
- name: Run pre-commit checks
26+
uses: pre-commit/action@v3.0.1
2527
- name: Cache MyPy
2628
uses: actions/cache@v4
2729
with:

.github/workflows/unit_tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ jobs:
8080
with:
8181
node-version-file: './ui/.nvmrc'
8282
registry-url: 'https://registry.npmjs.org'
83+
cache: 'yarn'
84+
cache-dependency-path: 'ui/yarn.lock'
8385
- name: Install yarn dependencies
8486
working-directory: ./ui
8587
run: yarn install

.pre-commit-config.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
default_stages: [commit]
22

3+
# Generated protobuf files should not be linted or formatted.
4+
# They are produced by `make compile-protos-python` and must be excluded globally.
5+
exclude: '^sdk/python/feast/protos/'
6+
37
repos:
48
- repo: local
59
hooks:
@@ -29,17 +33,25 @@ repos:
2933
stages: [commit]
3034
language: system
3135
files: ^infra/templates/|\.jinja2$|^docs/roadmap\.md$
32-
entry: make build-templates
36+
entry: uv run make build-templates
3337
pass_filenames: false
3438

3539
- repo: https://github.com/Yelp/detect-secrets
3640
rev: v1.5.0
3741
hooks:
3842
- id: detect-secrets
43+
args: ['--baseline', '.secrets.baseline']
3944
exclude: |
4045
(?x)^(
4146
.*\.lock|
4247
.*requirements.*\.txt|
4348
.*\.svg|
4449
.*\.html
4550
)$
51+
52+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
53+
rev: v9.18.0
54+
hooks:
55+
- id: commitlint
56+
stages: [commit-msg]
57+
additional_dependencies: ["@commitlint/config-conventional"]

0 commit comments

Comments
 (0)