Parent directory

format.yml

1403 bytes
 1name: PR Lint Format
 2
 3permissions:
 4  contents: read
 5
 6on:
 7  pull_request:
 8    paths:
 9    - 'drivers/**'
10    - 'lib/arm_atsam/**'
11    - 'lib/lib8tion/**'
12    - 'lib/python/**'
13    - 'platforms/**'
14    - 'quantum/**'
15    - 'tests/**'
16    - 'tmk_core/**'
17
18jobs:
19  lint:
20    runs-on: ubuntu-latest
21
22    container: ghcr.io/qmk/qmk_cli
23
24    steps:
25    - name: Disable safe.directory check
26      run : git config --global --add safe.directory '*'
27
28    - uses: actions/checkout@v4
29      with:
30        fetch-depth: 0
31
32    - name: Install dependencies
33      run: |
34        pip3 install -r requirements-dev.txt
35
36    - name: Get changed files
37      id: file_changes
38      uses: tj-actions/changed-files@v45
39      with:
40        use_rest_api: true
41
42    - name: Run qmk formatters
43      shell: 'bash {0}'
44      run: |
45        echo '${{ steps.file_changes.outputs.added_files}}' '${{ steps.file_changes.outputs.modified_files}}' > ~/files_changed.txt
46        qmk format-c --core-only $(< ~/files_changed.txt) || true
47        qmk format-python $(< ~/files_changed.txt) || true
48        qmk format-text $(< ~/files_changed.txt) || true
49
50    - name: Fail when formatting required
51      run: |
52        git diff
53        for file in $(git diff --name-only); do
54          echo "File '${file}' Requires Formatting"
55          echo "::error file=${file}::Requires Formatting"
56        done
57        test -z "$(git diff --name-only)"