forked from entrius/gittensor
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (46 loc) · 1.74 KB
/
Copy pathlint.yml
File metadata and controls
58 lines (46 loc) · 1.74 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
name: Lint
on:
pull_request:
branches: [main, test]
env:
PYTHON_VERSION: "3.12"
jobs:
# If PR is from the same repo, auto-commit lint fixes
pre-commit:
runs-on: ubuntu-latest
permissions:
contents: write
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: astral-sh/setup-uv@v4
- run: uv python install ${{ env.PYTHON_VERSION }}
- run: uv sync --extra dev
- name: Run pre-commit with auto-fixes
run: uv run pre-commit run --all-files || true
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: auto-format with pre-commit"
- name: Re-run pre-commit to verify clean
run: uv run pre-commit run --all-files
- name: Run pre-push checks (pyright, vulture)
run: SKIP=pytest uv run pre-commit run --all-files --hook-stage pre-push
# If PR is from a fork, fail on any diff
pre-commit-fork:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- uses: astral-sh/setup-uv@v4
- run: uv python install ${{ env.PYTHON_VERSION }}
- run: uv sync --extra dev
- name: Run pre-commit checks
run: uv run pre-commit run --all-files --show-diff-on-failure
- name: Run pre-push checks (pyright, vulture)
run: SKIP=pytest uv run pre-commit run --all-files --hook-stage pre-push