lint.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Workflow that runs lint on the frontend and python code
  2. name: Lint
  3. # The jobs in this workflow are required, so they must run at all times
  4. # Always run on "main"
  5. # Always run on PRs
  6. on:
  7. push:
  8. branches:
  9. - main
  10. pull_request:
  11. # If triggered by a PR, it will be in the same group. However, each commit on main will be in its own unique group
  12. concurrency:
  13. group: ${{ github.workflow }}-${{ (github.head_ref && github.ref) || github.run_id }}
  14. cancel-in-progress: true
  15. jobs:
  16. # Run lint on the frontend code
  17. lint-frontend:
  18. name: Lint frontend
  19. runs-on: ubuntu-latest
  20. steps:
  21. - uses: actions/checkout@v4
  22. - name: Install Node.js 20
  23. uses: actions/setup-node@v4
  24. with:
  25. node-version: 20
  26. - name: Install dependencies
  27. run: |
  28. cd frontend
  29. npm install --frozen-lockfile
  30. - name: Lint
  31. run: |
  32. cd frontend
  33. npm run lint
  34. # Run lint on the python code
  35. lint-python:
  36. name: Lint python
  37. runs-on: ubuntu-latest
  38. steps:
  39. - uses: actions/checkout@v4
  40. with:
  41. fetch-depth: 0
  42. - name: Set up python
  43. uses: actions/setup-python@v5
  44. with:
  45. python-version: 3.12
  46. cache: 'pip'
  47. - name: Install pre-commit
  48. run: pip install pre-commit==3.7.0
  49. - name: Run pre-commit hooks
  50. run: pre-commit run --files openhands/**/* evaluation/**/* tests/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml