Skip to content

Commit a2781d5

Browse files
Kin Long Kelvin LeePennycook
authored andcommitted
ci: add Github action to run pre-commit
Signed-off-by: Kin Long Kelvin Lee <kin.long.kelvin.lee@intel.com>
1 parent e2a8736 commit a2781d5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/run-precommit.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Run pre-commit hooks
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- uses: actions/setup-python@v5
17+
name: Install Python 3.12
18+
with:
19+
python-version: "3.12"
20+
cache: 'pip'
21+
- run: pip install -U pip setuptools
22+
- uses: pre-commit/action@v3.0.1
23+
name: Configure and run pre-commit on changed files
24+
with:
25+
# the intention with this is to run pre-commit only
26+
# on the diff submitted with this PR
27+
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
28+
permissions: read-all

0 commit comments

Comments
 (0)