-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (45 loc) · 1.59 KB
/
lint_and_format.yaml
File metadata and controls
54 lines (45 loc) · 1.59 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
# .github/workflows/lint_and_format.yaml
name: Code Quality Checks
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
types: [opened, synchronize, reopened]
jobs:
run-pre-commit:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository code
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
# Add this to ensure pip's bin directory is in PATH
# It's usually the default, but explicitly setting can help
cache-dependency-path: requirements.txt # If you use requirements.txt
# For Linux runners, the executable should be in ~/.local/bin or similar.
# setup-python typically adds this to PATH, but being explicit helps debug.
- name: Upgrade pip and install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Verify pre-commit installation
run: |
which pre-commit # This command shows the full path to the executable
pre-commit --version # This confirms it's found and runnable
- name: Set up git authentication for pre-commit
run: |
git config --global url."https://x-oauth-basic:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Run pre-commit hooks
run: pre-commit run --all-files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}