-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (36 loc) · 1.07 KB
/
Copy pathpre-commit.yaml
File metadata and controls
42 lines (36 loc) · 1.07 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
---
name: pre-commit
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
# Required to grab the full history for proper pre-commit checks
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v6.3.0
with:
python-version: "3.11"
# Cache the pre-commit environments based on the config file hash
- name: Cache Pre-Commit Environments
uses: actions/cache@v6
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
with:
extra_args: >-
--color=always
--from-ref ${{ github.event.pull_request.base.sha || github.event.before }}
--to-ref ${{ github.event.pull_request.head.sha || github.sha }}