format.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: PR Lint Format
  2. permissions:
  3. contents: read
  4. on:
  5. pull_request:
  6. paths:
  7. - 'drivers/**'
  8. - 'lib/arm_atsam/**'
  9. - 'lib/lib8tion/**'
  10. - 'lib/python/**'
  11. - 'platforms/**'
  12. - 'quantum/**'
  13. - 'tests/**'
  14. - 'tmk_core/**'
  15. jobs:
  16. lint:
  17. runs-on: ubuntu-latest
  18. container: qmkfm/qmk_cli
  19. steps:
  20. - uses: actions/checkout@v3
  21. with:
  22. fetch-depth: 0
  23. - name: Install dependencies
  24. run: |
  25. pip3 install -r requirements-dev.txt
  26. - uses: trilom/file-changes-action@v1.2.4
  27. id: file_changes
  28. with:
  29. output: ' '
  30. fileOutput: ' '
  31. - name: Run qmk formatters
  32. shell: 'bash {0}'
  33. run: |
  34. cat ~/files_added.txt ~/files_modified.txt > ~/files_changed.txt
  35. qmk format-c --core-only $(< ~/files_changed.txt) || true
  36. qmk format-python $(< ~/files_changed.txt) || true
  37. qmk format-text $(< ~/files_changed.txt) || true
  38. - name: Fail when formatting required
  39. run: |
  40. git diff
  41. for file in $(git diff --name-only); do
  42. echo "File '${file}' Requires Formatting"
  43. echo "::error file=${file}::Requires Formatting"
  44. done
  45. test -z "$(git diff --name-only)"