You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4 KiB

  1. name: PR Lint keyboards
  2. on:
  3. pull_request:
  4. paths:
  5. - 'keyboards/**'
  6. jobs:
  7. lint:
  8. runs-on: ubuntu-latest
  9. container: qmkfm/qmk_cli
  10. steps:
  11. - uses: actions/checkout@v3
  12. with:
  13. fetch-depth: 0
  14. - name: Install dependencies
  15. run: pip3 install -r requirements-dev.txt
  16. - uses: trilom/file-changes-action@v1.2.4
  17. id: file_changes
  18. with:
  19. output: '\n'
  20. - name: Print info
  21. run: |
  22. git rev-parse --short HEAD
  23. echo ${{ github.event.pull_request.base.sha }}
  24. echo '${{ steps.file_changes.outputs.files}}'
  25. - name: Run qmk lint
  26. shell: 'bash {0}'
  27. run: |
  28. QMK_CHANGES=$(echo -e '${{ steps.file_changes.outputs.files}}')
  29. QMK_KEYBOARDS=$(qmk list-keyboards)
  30. exit_code=0
  31. for KB in $QMK_KEYBOARDS; do
  32. KEYBOARD_CHANGES=$(echo "$QMK_CHANGES" | grep -E '^(keyboards/'${KB}'/)')
  33. if [[ -z "$KEYBOARD_CHANGES" ]]; then
  34. # skip as no changes for this keyboard
  35. continue
  36. fi
  37. KEYMAP_ONLY=$(echo "$KEYBOARD_CHANGES" | grep -cv /keymaps/)
  38. if [[ $KEYMAP_ONLY -gt 0 ]]; then
  39. echo "linting ${KB}"
  40. qmk lint --keyboard ${KB} && qmk info -l --keyboard ${KB}
  41. exit_code=$(($exit_code + $?))
  42. fi
  43. done
  44. if [[ $exit_code -gt 255 ]]; then
  45. exit 255
  46. fi
  47. exit $exit_code