-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 1.83 KB
/
Copy pathpre-commit.yaml
File metadata and controls
72 lines (63 loc) · 1.83 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: pre-commit
on:
# Run on push to master
push:
branches:
- master
# Run on pull request actions
pull_request:
types: [opened, reopened, synchronize]
# Manual trigger
workflow_dispatch:
# Prevent parallel runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
# Global env vars
env:
PYTHON_VERSION: "3.12"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
# Checkout code and keep creds for push
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: true
# Setup Python
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
# Setup Node.js for JS hooks
- name: Use Node.js 24.x
uses: actions/setup-node@v3
with:
node-version: "24.x"
# Cache NPM deps
- name: Cache NPM
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-npm-
restore-keys: |
${{ runner.os }}-npm-
# Cache pip for Python hook installs
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# Install JS devDependencies
- name: Install devDependencies
run: npm install --legacy-peer-deps
- name: Install specific setuptools version
run: pip install setuptools==81.0.0
# Run pre-commit in check-only mode (fail on any diffs)
- name: Run pre-commit (check-only)
uses: pre-commit/action@v3.0.1
with:
args: run --all-files --show-diff-on-failure