printer-linter-pr-diagnose.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. DIFF_FILTER: AMRCD
  18. PATTERNS: |
  19. resources/+(extruders|definitions)/*.def.json
  20. resources/+(intent|quality|variants)/**/*.inst.cfg
  21. - name: Setup Python and pip
  22. if: env.GIT_DIFF && !env.MATCHED_FILES # If nothing happens with python and/or pip after, the clean-up crashes.
  23. uses: actions/setup-python@v4
  24. with:
  25. python-version: 3.11.x
  26. cache: "pip"
  27. cache-dependency-path: .github/workflows/requirements-printer-linter.txt
  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: Create results directory
  32. run: mkdir printer-linter-result
  33. - name: Diagnose file(s)
  34. if: env.GIT_DIFF && !env.MATCHED_FILES
  35. run: python printer-linter/src/terminal.py --diagnose --report printer-linter-result/fixes.yml ${{ env.GIT_DIFF_FILTERED }}
  36. - name: Check Deleted Files(s)
  37. if: env.GIT_DIFF
  38. run: python printer-linter/src/terminal.py --deleted --report printer-linter-result/comment.md ${{ env.GIT_DIFF_FILTERED }}
  39. - name: Save PR metadata
  40. run: |
  41. echo ${{ github.event.number }} > printer-linter-result/pr-id.txt
  42. echo ${{ github.event.pull_request.head.repo.full_name }} > printer-linter-result/pr-head-repo.txt
  43. echo ${{ github.event.pull_request.head.ref }} > printer-linter-result/pr-head-ref.txt
  44. - uses: actions/upload-artifact@v2
  45. with:
  46. name: printer-linter-result
  47. path: printer-linter-result/
  48. - name: Run clang-tidy-pr-comments action
  49. uses: platisd/clang-tidy-pr-comments@bc0bb7da034a8317d54e7fe1e819159002f4cc40
  50. with:
  51. github_token: ${{ secrets.GITHUB_TOKEN }}
  52. clang_tidy_fixes: result.yml
  53. request_changes: true