-
-
Notifications
You must be signed in to change notification settings - Fork 47
40 lines (34 loc) · 1.05 KB
/
main.yml
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
name: Lint
on:
push:
branches: [ master ]
pull_request:
types: [ opened, reopened, synchronize ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch head and base refs
# This is necessary for pre-commit to check the changes in the PR branch
run: |
git fetch origin ${{ github.base_ref }}:base_ref
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_ref
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Restore cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ hashFiles('requirements*') }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip wheel
python3 -m pip install --upgrade --upgrade-strategy eager pre-commit
sudo apt-get install -y git
- name: Run pre-commit
run: |
pre-commit run --from-ref base_ref --to-ref pr_ref --show-diff-on-failure