-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (68 loc) · 2.09 KB
/
Copy pathpre-commit-uv.yml
File metadata and controls
70 lines (68 loc) · 2.09 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
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
name: pre-commit
on:
workflow_call:
inputs:
python-version:
required: false
type: string
default: ''
uv-version:
required: false
type: string
default: latest
pre-commit-args:
required: false
type: string
default: ''
debug-enabled:
required: false
type: boolean
default: false
secrets:
ssh-private-key:
required: false
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# required to grab the history of the PR for pre-commit
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.debug-enabled }}
with:
detached: true
- uses: webfactory/ssh-agent@v0.10.0
env:
ssh-private-key: ${{ secrets.ssh-private-key }}
if: ${{ env.ssh-private-key != '' }}
with:
ssh-private-key: ${{ secrets.ssh-private-key }}
# We support a specific Python version as arg or reading it from
# the .python-version file. If there is not a .python-version file
# it will pick the first Python version allowed by looking at the
# `requires-python` field of the `pyproject.toml` file.
- name: Install uv and Python
if: ${{ inputs.python-version != '' }}
uses: astral-sh/setup-uv@v7
with:
version: ${{ inputs.uv-version }}
enable-cache: true
cache-dependency-glob: uv.lock
python-version: ${{ inputs.python-version }}
- name: Install uv and Python using .python-version
if: ${{ inputs.python-version == '' }}
uses: astral-sh/setup-uv@v7
with:
version: ${{ inputs.uv-version }}
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install the project
run: |
uv sync --locked --dev --all-extras
uv pip install pre-commit-uv
- uses: pre-commit/action@v3.0.1
with:
extra_args: ${{ inputs.pre-commit-args }}