printer-linter-pr-diagnose.yml 2.3 KB

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