-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (30 loc) · 899 Bytes
/
pre-commit.yml
File metadata and controls
31 lines (30 loc) · 899 Bytes
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
---
name: pre-commit
on:
push:
branches: [ main ]
pull_request:
jobs:
pre-commit:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: '3.12'
# manual execute pre-commit,instead of `- uses: pre-commit/action@v3.0.1`
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
pre-commit run --show-diff-on-failure --color=always \
--from-ref "${{ github.event.pull_request.base.sha }}" \
--to-ref "${{ github.event.pull_request.head.sha }}"
else
pre-commit run --show-diff-on-failure --color=always --all-files
fi