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

  hadolint:
    name: hadolint
    runs-on: ubuntu-latest
    steps:
      - name: Git clone repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Check files
        run: |
          if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*Dockerfile*' ; then
            echo 'run_hadolint=1' >> $GITHUB_ENV
          fi
      - name: Run hadolint
        if: env.run_hadolint == 1
        uses: reviewdog/action-hadolint@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-check

  shellcheck:
    name: shellcheck
    runs-on: ubuntu-latest
    steps:
      - name: Git clone repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Check files
        run: |
          if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*\.sh.*' ; then
            echo 'run_shellcheck=1' >> $GITHUB_ENV
          fi
      - name: Run shellcheck
        if: env.run_shellcheck == 1
        uses: reviewdog/action-shellcheck@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-check
          path: "."
          pattern: "*.sh*"
          exclude: "./.git/*"

  yamllint:
    name: yamllint
    runs-on: ubuntu-latest
    steps:
      - name: Git clone repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Check files
        run: |
          if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '*\.ya?ml|python\.d/.*\.conf' ; then
            echo 'run_yamllint=1' >> $GITHUB_ENV
          fi
      - name: Run yamllint
        if: env.run_yamllint == 1
        uses: reviewdog/action-yamllint@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-check