generated from smiths/capTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.66 KB
/
python-lint.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
name: "Lint Python Files"
on:
pull_request:
types: [opened, reopened, synchronize]
branches: [dev]
paths:
- "src/**/*.py"
jobs:
lint:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Create app access token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.SCO_COMMIT_APP }}
private-key: ${{ secrets.SCO_APP_KEY }}
# Checkout repository
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
# Get changed .py files
- name: Get changed .py files
id: changed-py-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.py
files_ignore: |
tests/input
tests/_input_copies
diff_relative: true # Get the list of files relative to the repo root
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
env:
ALL_CHANGED_FILES: ${{ steps.changed-py-files.outputs.all_changed_files }}
run: |
ruff check $ALL_CHANGED_FILES --output-format=github .