github.com/netdata/go.d.plugin@v0.58.1/.github/workflows/reviewdog.yml (about) 1 --- 2 # Runs various ReviewDog based checks against PR with suggested changes to improve quality 3 name: Review 4 on: 5 pull_request: 6 concurrency: 7 group: review-${{ github.ref }} 8 cancel-in-progress: true 9 jobs: 10 prep-review: 11 name: Prepare Review Jobs 12 runs-on: ubuntu-latest 13 outputs: 14 actionlint: ${{ steps.actionlint.outputs.run }} 15 golangci-lint: ${{ steps.golangci-lint.outputs.run }} 16 hadolint: ${{ steps.hadolint.outputs.run }} 17 shellcheck: ${{ steps.shellcheck.outputs.run }} 18 yamllint: ${{ steps.yamllint.outputs.run }} 19 steps: 20 - name: Clone repository 21 uses: actions/checkout@v4 22 with: 23 fetch-depth: 0 24 - name: Check files for actionlint 25 id: actionlint 26 run: | 27 if git diff --name-only origin/${{ github.base_ref }} HEAD -- | grep -Eq '\.github/workflows/.*' ; then 28 echo "run=true" >> $GITHUB_OUTPUT 29 echo 'GitHub Actions workflows have changed, need to run actionlint.' 30 else 31 echo "run=false" >> $GITHUB_OUTPUT 32 fi 33 - name: Check files for golangci-lint 34 id: golangci-lint 35 run: | 36 if git diff --name-only origin/${{ github.base_ref }} HEAD -- | grep -Eq '.*\.go' ; then 37 echo "run=true" >> $GITHUB_OUTPUT 38 echo 'Go code has changed, need to run golangci-lint.' 39 else 40 echo "run=false" >> $GITHUB_OUTPUT 41 fi 42 - name: Check files for hadolint 43 id: hadolint 44 run: | 45 if git diff --name-only origin/${{ github.base_ref }} HEAD -- | grep -Eq '.*Dockerfile.*' ; then 46 echo "run=true" >> $GITHUB_OUTPUT 47 echo 'Dockerfiles have changed, need to run Hadolint.' 48 else 49 echo "run=false" >> $GITHUB_OUTPUT 50 fi 51 - name: Check files for shellcheck 52 id: shellcheck 53 run: | 54 if git diff --name-only origin/${{ github.base_ref }} HEAD -- | grep -Eq '.*\.sh.*' ; then 55 echo "run=true" >> $GITHUB_OUTPUT 56 echo 'Shell scripts have changed, need to run shellcheck.' 57 else 58 echo "run=false" >> $GITHUB_OUTPUT 59 fi 60 - name: Check files for yamllint 61 id: yamllint 62 run: | 63 if git diff --name-only origin/${{ github.base_ref }} HEAD -- | grep -Eq '.*\.ya?ml|config/.*\.conf' ; then 64 echo "run=true" >> $GITHUB_OUTPUT 65 echo 'YAML files have changed, need to run yamllint.' 66 else 67 echo "run=false" >> $GITHUB_OUTPUT 68 fi 69 70 actionlint: 71 name: actionlint 72 needs: prep-review 73 if: needs.prep-review.outputs.actionlint == 'true' 74 runs-on: ubuntu-latest 75 steps: 76 - name: Git clone repository 77 uses: actions/checkout@v4 78 - name: Run actionlint 79 uses: reviewdog/action-actionlint@v1 80 with: 81 github_token: ${{ secrets.GITHUB_TOKEN }} 82 reporter: github-pr-check 83 84 golangci-lint: 85 name: golangci-lint 86 needs: prep-review 87 if: needs.prep-review.outputs.golangci-lint == 'true' 88 runs-on: ubuntu-latest 89 steps: 90 - name: Checkout 91 uses: actions/checkout@v4 92 - name: Run golangci-lint 93 uses: reviewdog/action-golangci-lint@v2 94 with: 95 github_token: ${{ secrets.GITHUB_TOKEN }} 96 reporter: github-pr-check 97 golangci_lint_flags: '--timeout=10m' 98 99 hadolint: 100 name: hadolint 101 needs: prep-review 102 if: needs.prep-review.outputs.hadolint == 'true' 103 runs-on: ubuntu-latest 104 steps: 105 - name: Git clone repository 106 uses: actions/checkout@v4 107 - name: Run hadolint 108 uses: reviewdog/action-hadolint@v1 109 with: 110 github_token: ${{ secrets.GITHUB_TOKEN }} 111 reporter: github-pr-check 112 113 shellcheck: 114 name: shellcheck 115 needs: prep-review 116 if: needs.prep-review.outputs.shellcheck == 'true' 117 runs-on: ubuntu-latest 118 steps: 119 - name: Git clone repository 120 uses: actions/checkout@v4 121 - name: Run shellcheck 122 uses: reviewdog/action-shellcheck@v1 123 with: 124 github_token: ${{ secrets.GITHUB_TOKEN }} 125 reporter: github-pr-check 126 path: "." 127 pattern: "*.sh*" 128 exclude: "./.git/*" 129 130 yamllint: 131 name: yamllint 132 needs: prep-review 133 if: needs.prep-review.outputs.yamllint == 'true' 134 runs-on: ubuntu-latest 135 steps: 136 - name: Git clone repository 137 uses: actions/checkout@v4 138 - name: Run yamllint 139 uses: reviewdog/action-yamllint@v1 140 with: 141 github_token: ${{ secrets.GITHUB_TOKEN }} 142 reporter: github-pr-check