linters.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: Linters
  2. permissions:
  3. contents: read
  4. on:
  5. pull_request:
  6. branches:
  7. - main
  8. workflow_dispatch:
  9. jobs:
  10. jshint:
  11. name: Javascript Linter
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  15. with:
  16. persist-credentials: false
  17. - name: Install linters
  18. run: |
  19. sudo npm install -g --ignore-scripts jshint@2.13.6 eslint@8.57.0
  20. - name: Run jshint
  21. run: jshint internal/ui/static/js/*.js
  22. - name: Run ESLint
  23. run: eslint internal/ui/static/js/*.js
  24. golangci:
  25. name: Golang Linters
  26. runs-on: ubuntu-latest
  27. steps:
  28. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  29. with:
  30. persist-credentials: false
  31. - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
  32. with:
  33. go-version: stable
  34. - uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
  35. - name: Run gofmt linter
  36. run: gofmt -d -e .
  37. commitlint:
  38. if: github.event_name == 'pull_request'
  39. name: Commit Linter
  40. runs-on: ubuntu-latest
  41. steps:
  42. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  43. with:
  44. persist-credentials: false
  45. fetch-depth: 0
  46. - name: Set up Python
  47. uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
  48. with:
  49. python-version: '3.13'
  50. - name: Validate PR commits
  51. env:
  52. BASE_SHA: ${{ github.event.pull_request.base.sha }}
  53. HEAD_SHA: ${{ github.event.pull_request.head.sha }}
  54. run: python3 .github/workflows/scripts/commit-checker.py --base "$BASE_SHA" --head "$HEAD_SHA"