-
Notifications
You must be signed in to change notification settings - Fork 85
83 lines (70 loc) · 2.37 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Pre-commit
#
# Runs pre-commit hooks and auto commit fixes.
#
# - https://pre-commit.ci/lite.html
# - https://github.com/pre-commit-ci/lite-action
# - https://github.com/apps/pre-commit-ci-lite
#
# Relies on the pre-commit.ci lite GitHub app to be configured with this repo.
#
# Why is the non-lite pre-commit.ci not used instead? It does not support local
# hooks using "system" as language which is heavily used within this project.
#
# Unlike the full version, lite does not perform automatic upgrades of hooks.
#
on:
workflow_dispatch:
pull_request:
push:
branches: [master, dev]
schedule:
# At 04:04 on Monday.
- cron: 4 4 * * 1
env:
poetry_version: "1.8.2"
python_version: "3.12"
jobs:
pre-commit:
name: Pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# ------------------------------------------------------------------------
# Python & Poetry.
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Cache Poetry installation
uses: actions/cache@v4
with:
path: |
~/.local/bin/poetry
~/.local/share/pypoetry
key: |-
${{ runner.os }}-poetry-installation-${{ env.python_version }}-${{ env.poetry_version }}-0
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python -
env:
POETRY_VERSION: ${{ env.poetry_version }}
- name: Cache Poetry cache
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: |-
${{ runner.os }}-poetry-cache-${{ env.python_version }}-${{ env.poetry_version }}-${{ hashFiles('poetry.lock') }}-0
restore-keys: |
${{ runner.os }}-poetry-cache-${{ env.python_version }}-${{ env.poetry_version }}-
${{ runner.os }}-poetry-cache-${{ env.python_version }}-
- name: Install deps with Poetry
run: poetry install --no-interaction
# ------------------------------------------------------------------------
# Pre-commit.
- name: Install, cache, and run pre-commit
uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()
with:
msg: "ci(pre-commit): Apply hook auto fixes"