format.yml 1.2 KB

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