-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (44 loc) · 1.46 KB
/
pre-commit.yaml
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
---
name: "Pre-commit"
on: # yamllint disable-line rule:truthy
push:
branches:
- main
tags: ["*"]
pull_request:
# The branches below must be a subset of the branches above
branches:
- main
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up Python
id: py-pc
# https://github.com/actions/setup-python
# yamllint disable-line rule:line-length
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.11"
- name: Enable cache for pre-commit hooks
# https://github.com/actions/cache
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: ~/.cache/pre-commit
# yamllint disable-line rule:line-length
key: pre-commit|${{ steps.py-pc.outputs.python-version}}|${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit|${{ steps.py-pc.outputs.python-version}}|
pre-commit|
- name: Install pre-commit
run: |
pip install --upgrade pre-commit
pre-commit --version
- name: Run pre-commit checks
run: pre-commit run -a
- name: Run pre-commit gc
run: pre-commit gc