Skip to content

Commit 179380f

Browse files
DeanChensjcopybara-github
authored andcommitted
chore: Introduce pre-commit configuration and scripts
Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 903957079
1 parent 34713fb commit 179380f

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: pre-commit
16+
17+
on:
18+
push:
19+
branches: [main, v2]
20+
paths:
21+
- '**.py'
22+
- '.pre-commit-config.yaml'
23+
- 'pyproject.toml'
24+
pull_request:
25+
branches: [main, v2]
26+
paths:
27+
- '**.py'
28+
- '.pre-commit-config.yaml'
29+
- 'pyproject.toml'
30+
31+
jobs:
32+
pre-commit:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout Code
36+
uses: actions/checkout@v6
37+
38+
- name: Run pre-commit checks
39+
uses: pre-commit/action@v3.0.1

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ dev = [
9090
"flit>=3.10.0",
9191
"isort>=6.0.0",
9292
"mypy>=1.15.0",
93+
"pre-commit>=4.0.0",
9394
"pyink>=25.12.0",
9495
"pylint>=2.6.0",
9596
# go/keep-sorted end

0 commit comments

Comments
 (0)