qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

lint.yml (2280B)


      1 name: PR Lint keyboards
      2 
      3 permissions:
      4   contents: read
      5 
      6 on:
      7   pull_request:
      8     paths:
      9     - 'keyboards/**'
     10 
     11 jobs:
     12   lint:
     13     runs-on: ubuntu-latest
     14 
     15     container: ghcr.io/qmk/qmk_cli
     16 
     17     steps:
     18     - name: Disable safe.directory check
     19       run : git config --global --add safe.directory '*'
     20 
     21     - uses: actions/checkout@v6
     22       with:
     23         fetch-depth: 0
     24 
     25     - name: Install dependencies
     26       run: pip3 install -r requirements-dev.txt
     27 
     28     - name: Get changed files
     29       id: file_changes
     30       uses: tj-actions/changed-files@v47
     31       with:
     32         use_rest_api: true
     33 
     34     - name: Print info
     35       run: |
     36         git rev-parse --short HEAD
     37         echo ${{ github.event.pull_request.base.sha }}
     38         echo '${{ steps.file_changes.outputs.all_changed_files}}'
     39 
     40     - name: Run qmk lint
     41       if: always()
     42       shell: 'bash {0}'
     43       run: |
     44         QMK_CHANGES=$(echo -e '${{ steps.file_changes.outputs.all_changed_files}}' | sed 's/ /\n/g')
     45         QMK_KEYBOARDS=$(qmk list-keyboards)
     46 
     47         exit_code=0
     48 
     49         for KB in $QMK_KEYBOARDS; do
     50           KEYBOARD_CHANGES=$(echo "$QMK_CHANGES" | grep -E '^(keyboards/'${KB}'/)')
     51           if [[ -z "$KEYBOARD_CHANGES" ]]; then
     52             # skip as no changes for this keyboard
     53             continue
     54           fi
     55 
     56           KEYMAP_ONLY=$(echo "$KEYBOARD_CHANGES" | grep -cv /keymaps/)
     57           if [[ $KEYMAP_ONLY -gt 0 ]]; then
     58             echo "linting ${KB}"
     59 
     60             qmk lint --keyboard ${KB} && qmk info -l --keyboard ${KB}
     61             exit_code=$(($exit_code + $?))
     62           fi
     63         done
     64 
     65         qmk format-text ${{ steps.file_changes.outputs.all_changed_files}} || true
     66         for file in ${{ steps.file_changes.outputs.all_changed_files}}; do
     67           if [[ -f $file ]]; then
     68             if ! git diff --quiet $file; then
     69               echo "File '${file}' Requires Formatting"
     70               echo "::error file=${file}::Requires Formatting"
     71               exit_code=$(($exit_code + 1))
     72             fi
     73           fi
     74         done
     75 
     76         if [[ $exit_code -gt 255 ]]; then
     77             exit 255
     78         fi
     79         exit $exit_code
     80 
     81     - name: Verify keyboard aliases
     82       if: always()
     83       shell: 'bash {0}'
     84       run: |
     85         git reset --hard
     86         git clean -xfd
     87         qmk ci-validate-aliases