-
Notifications
You must be signed in to change notification settings - Fork 1.8k
53 lines (41 loc) · 1.55 KB
/
_lint.yml
File metadata and controls
53 lines (41 loc) · 1.55 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
name: 11. _Lint Checks
on:
workflow_call:
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Required to calculate the git diff
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install dependencies
run: uv sync --frozen --extra dev
# --- NEW STEP: Get the list of changed files ---
- name: Get changed files
id: files
run: |
# Compare the PR head to the base branch
echo "changed_files=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }} HEAD | grep '\.py$' | xargs)" >> $GITHUB_OUTPUT
# --- UPDATED STEPS: Use the file list ---
- name: List files
run: echo "The changed files are ${{ steps.files.outputs.changed_files }}"
- name: Format with ruff (Changed files only)
if: steps.files.outputs.changed_files != ''
run: uv run ruff format --check ${{ steps.files.outputs.changed_files }}
- name: Lint with ruff (Changed files only)
if: steps.files.outputs.changed_files != ''
run: uv run ruff check ${{ steps.files.outputs.changed_files }}
- name: Type check with mypy (Changed files only)
if: steps.files.outputs.changed_files != ''
# Note: Running mypy on specific files may miss cross-file type errors
run: uv run mypy ${{ steps.files.outputs.changed_files }}
continue-on-error: true