printer-linter-format.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. - name: Setup Python and pip
  18. uses: actions/setup-python@v4
  19. with:
  20. python-version: 3.11.x
  21. cache: 'pip'
  22. cache-dependency-path: .github/workflows/requirements-printer-linter.txt
  23. - uses: technote-space/get-diff-action@v6
  24. with:
  25. PATTERNS: |
  26. resources/+(definitions|extruders)/*.def.json
  27. resources/+(intent|quality|variants)/**/*.inst.cfg
  28. - name: Install Python requirements for runner
  29. if: env.GIT_DIFF && !env.MATCHED_FILES
  30. run: pip install -r .github/workflows/requirements-printer-linter.txt
  31. - name: Format file
  32. if: env.GIT_DIFF && !env.MATCHED_FILES
  33. run: python printer-linter/src/terminal.py --format ${{ env.GIT_DIFF_FILTERED }}
  34. - uses: stefanzweifel/git-auto-commit-action@v4
  35. if: env.GIT_DIFF && !env.MATCHED_FILES
  36. with:
  37. commit_message: "Applied printer-linter format"