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