forked from smartHomeHub/SmartIR
-
Notifications
You must be signed in to change notification settings - Fork 33
60 lines (53 loc) · 1.66 KB
/
lint.yml
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
name: "Lint"
on:
pull_request:
branches: [ "master" ]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44.5.6
with:
fetch_depth: "100"
files_yaml: |
codes:
- 'codes/*/*.json'
auto:
- 'docs/*_CODES.md'
- name: Prevent changes to the auto generated docs
if: steps.changed-files.outputs.auto_any_changed == 'true'
env:
ALL_CHANGED_AUTO_FILES: ${{ steps.changed-files.outputs.auto_all_changed_files }}
run: |
FILES=""
for file in ${ALL_CHANGED_AUTO_FILES}; do
echo "File "$FILE" is auto generated and should not be modified!""
done
exit 1
- name: Set up Python
if: steps.changed-files.outputs.codes_any_changed == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.X"
- name: Validate device code files
if: steps.changed-files.outputs.codes_any_changed == 'true'
env:
ALL_CHANGED_DEVICE_FILES: ${{ steps.changed-files.outputs.codes_all_changed_files }}
run: |
FILES=""
for file in ${ALL_CHANGED_DEVICE_FILES}; do
FILES="$FILES $file"
done
python3 test_device_data.py $FILES