printer-linter-pr-diagnose.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: printer-linter-pr-diagnose
  2. on:
  3. pull_request:
  4. path:
  5. - "resources/**"
  6. jobs:
  7. printer-linter-diagnose:
  8. name: Printer linter PR diagnose
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Checkout
  12. uses: actions/checkout@v3
  13. with:
  14. fetch-depth: 2
  15. - uses: technote-space/get-diff-action@v6
  16. with:
  17. PATTERNS: |
  18. resources/+(extruders|definitions)/*.def.json
  19. resources/+(intent|quality|variants)/**/*.inst.cfg
  20. - name: Setup Python and pip
  21. if: env.GIT_DIFF && !env.MATCHED_FILES # If nothing happens with python and/or pip after, the clean-up crashes.
  22. uses: actions/setup-python@v4
  23. with:
  24. python-version: 3.11.x
  25. cache: "pip"
  26. cache-dependency-path: .github/workflows/requirements-printer-linter.txt
  27. - name: Install Python requirements for runner
  28. if: env.GIT_DIFF && !env.MATCHED_FILES
  29. run: pip install -r .github/workflows/requirements-printer-linter.txt
  30. - name: Create results directory
  31. run: mkdir printer-linter-result
  32. - name: Diagnose file(s)
  33. if: env.GIT_DIFF && !env.MATCHED_FILES
  34. run: python printer-linter/src/terminal.py --diagnose --report printer-linter-result/fixes.yml ${{ env.GIT_DIFF_FILTERED }}
  35. - name: Save PR metadata
  36. run: |
  37. echo ${{ github.event.number }} > printer-linter-result/pr-id.txt
  38. echo ${{ github.event.pull_request.head.repo.full_name }} > printer-linter-result/pr-head-repo.txt
  39. echo ${{ github.event.pull_request.head.ref }} > printer-linter-result/pr-head-ref.txt
  40. - uses: actions/upload-artifact@v2
  41. with:
  42. name: printer-linter-result
  43. path: printer-linter-result/
  44. - name: Run clang-tidy-pr-comments action
  45. uses: platisd/clang-tidy-pr-comments@bc0bb7da034a8317d54e7fe1e819159002f4cc40
  46. with:
  47. github_token: ${{ secrets.GITHUB_TOKEN }}
  48. clang_tidy_fixes: result.yml
  49. request_changes: true