printer-linter-format.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: printer-linter-format
  2. on:
  3. push:
  4. paths:
  5. - 'resources/definitions/**'
  6. - 'resources/extruders/**'
  7. - 'resources/intent/**'
  8. - 'resources/quality/**'
  9. - 'resources/variants/**'
  10. jobs:
  11. printer-linter-format:
  12. name: Printer linter auto format
  13. runs-on: ubuntu-latest
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v3
  17. - uses: technote-space/get-diff-action@v6
  18. with:
  19. PATTERNS: |
  20. resources/+(definitions|extruders)/*.def.json
  21. resources/+(intent|quality|variants)/**/*.inst.cfg
  22. - name: Setup Python and pip
  23. if: env.GIT_DIFF && !env.MATCHED_FILES # If nothing happens with python and/or pip after, the clean-up crashes.
  24. uses: actions/setup-python@v4
  25. with:
  26. python-version: 3.11.x
  27. cache: 'pip'
  28. cache-dependency-path: .github/workflows/requirements-printer-linter.txt
  29. - name: Install Python requirements for runner
  30. if: env.GIT_DIFF && !env.MATCHED_FILES
  31. run: pip install -r .github/workflows/requirements-printer-linter.txt
  32. - name: Format file
  33. if: env.GIT_DIFF && !env.MATCHED_FILES
  34. run: python printer-linter/src/terminal.py --format ${{ env.GIT_DIFF_FILTERED }}
  35. - uses: stefanzweifel/git-auto-commit-action@v4
  36. if: env.GIT_DIFF && !env.MATCHED_FILES
  37. with:
  38. commit_message: "Applied printer-linter format"