review.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ---
  2. # Runs various ReviewDog based checks against PR with suggested changes to improve quality
  3. name: Review
  4. on:
  5. pull_request: null
  6. env:
  7. run_eslint: 0
  8. run_hadolint: 0
  9. run_shellcheck: 0
  10. run_yamllint: 0
  11. DO_NOT_TRACK: 1
  12. jobs:
  13. eslint:
  14. name: eslint
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Git clone repository
  18. uses: actions/checkout@v2
  19. with:
  20. submodules: recursive
  21. fetch-depth: 0
  22. - name: Check files
  23. run: |
  24. if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -v "web/gui/dashboard" | grep -Eq '*\.js|node\.d\.plugin\.in' ; then
  25. echo 'run_eslint=1' >> $GITHUB_ENV
  26. fi
  27. - name: Run eslint
  28. if: env.run_eslint == 1
  29. uses: reviewdog/action-eslint@v1
  30. with:
  31. github_token: ${{ secrets.GITHUB_TOKEN }}
  32. reporter: github-pr-check
  33. eslint_flags: '.'
  34. hadolint:
  35. name: hadolint
  36. runs-on: ubuntu-latest
  37. steps:
  38. - name: Git clone repository
  39. uses: actions/checkout@v2
  40. with:
  41. fetch-depth: 0
  42. - name: Check files
  43. run: |
  44. if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*Dockerfile*' ; then
  45. echo 'run_hadolint=1' >> $GITHUB_ENV
  46. fi
  47. - name: Run hadolint
  48. if: env.run_hadolint == 1
  49. uses: reviewdog/action-hadolint@v1
  50. with:
  51. github_token: ${{ secrets.GITHUB_TOKEN }}
  52. reporter: github-pr-check
  53. shellcheck:
  54. name: shellcheck
  55. runs-on: ubuntu-latest
  56. steps:
  57. - name: Git clone repository
  58. uses: actions/checkout@v2
  59. with:
  60. submodules: recursive
  61. fetch-depth: 0
  62. - name: Check files
  63. run: |
  64. if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*\.sh.*' ; then
  65. echo 'run_shellcheck=1' >> $GITHUB_ENV
  66. fi
  67. - name: Run shellcheck
  68. if: env.run_shellcheck == 1
  69. uses: reviewdog/action-shellcheck@v1
  70. with:
  71. github_token: ${{ secrets.GITHUB_TOKEN }}
  72. reporter: github-pr-check
  73. path: "."
  74. pattern: "*.sh*"
  75. exclude: "./.git/*"
  76. yamllint:
  77. name: yamllint
  78. runs-on: ubuntu-latest
  79. steps:
  80. - name: Git clone repository
  81. uses: actions/checkout@v2
  82. with:
  83. submodules: recursive
  84. fetch-depth: 0
  85. - name: Check files
  86. run: |
  87. if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*\.ya?ml|python\.d/.*\.conf' ; then
  88. echo 'run_yamllint=1' >> $GITHUB_ENV
  89. fi
  90. - name: Run yamllint
  91. if: env.run_yamllint == 1
  92. uses: reviewdog/action-yamllint@v1
  93. with:
  94. github_token: ${{ secrets.GITHUB_TOKEN }}
  95. reporter: github-pr-check