-
Notifications
You must be signed in to change notification settings - Fork 3
44 lines (42 loc) · 1.2 KB
/
Copy pathpre-commit.yml
File metadata and controls
44 lines (42 loc) · 1.2 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
name: Pre-Commit
on:
pull_request:
branches:
- main
- dev
types:
- opened
- synchronize
- reopened
jobs:
pre-commit:
name: Run pre-commit checks
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.10"
- name: Cache pip
uses: actions/cache@v6
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ hashFiles('requirements.txt') }}
- name: Install pre-commit and dependencies
run: |
python -m pip install -U pip
python -m pip install -r ./requirements.txt
python -m pip install -U pre-commit pyright pytest
- name: Cache pre-commit
uses: actions/cache@v6
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit on all files
run: |
pre-commit run --all-files --show-diff-on-failure --color=always