forked from litinoveweedle/SmartIR
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (73 loc) · 2.39 KB
/
codeql_pr.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: "Pull Request CodeQL"
on:
pull_request:
branches: [ "master" ]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
security-events: write
strategy:
fail-fast: false
matrix:
language: [ python ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
# This is important to fetch the changes to the previous commit
fetch-depth: 0
- name: Get changed files
id: changed-device-files
uses: tj-actions/changed-files@v44
with:
files: codes/*/*.json
- name: Set up Python
if: steps.changed-device-files.outputs.any_changed == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.X"
- name: Test device code files
if: steps.changed-device-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_DEVICE_FILES: ${{ steps.changed-device-files.outputs.all_changed_files }}
run: |
FILES=""
for file in ${ALL_CHANGED_DEVICE_FILES}; do
FILES="$FILES $file"
done
python3 test_device_data.py $FILES
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
- name: Get changed files
id: changed-python-files
uses: tj-actions/changed-files@v44
with:
files: "**/*.py"
- name: Check Python files format
if: steps.changed-python-files.outputs.any_changed == 'true'
uses: psf/black@stable
with:
options: ""
src: ${{ steps.changed-python-files.outputs.all_changed_files }}
- name: Reformat JSON, YAML and MD files
uses: creyD/[email protected]
with:
only_changed: True
prettier_options: --write **/*.{json,yaml,md}
commit_message: ":art: Reformated Python, JSON, YAML and MD files"
commit_description: ""