review.yml 2.7 KB

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