diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5781ba..b57569a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,20 +1,71 @@ -name: "Terraform Module Update" -defaults: - run: - shell: bash - +name: ReviewDog on: push: branches: - develop - master + pull_request: + jobs: - module: + reviewdog-github-check: + if: github.event_name == 'push' + name: ReviewDog (github-check) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Terraform init + run: terraform init + + - name: Setup ReviewDog + run: | + mkdir -p $HOME/bin && curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b $HOME/bin + echo ::add-path::$HOME/bin + + - name: Run ReviewDog (github-check) + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + docker run --rm --name tflint -v $PWD:/data -t wata727/tflint --format=checkstyle | reviewdog -f=checkstyle -name="github-check" -reporter=github-check -level=warning -filter-mode=nofilter + + reviewdog-pr: + if: github.event_name == 'pull_request' + name: ReviewDog on Pull Request runs-on: ubuntu-latest steps: - - name: Checkout Code - uses: actions/checkout@v2-beta + - name: Checkout + uses: actions/checkout@v2 - - name: Create AWS Profile - run: make test + - name: Terraform init + run: terraform init + + - name: Setup ReviewDog + run: | + mkdir -p $HOME/bin && curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b $HOME/bin + echo ::add-path::$HOME/bin + + - name: Run ReviewDog (github-pr-check) + continue-on-error: true + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + docker run --rm --name tflint -v $PWD:/data -t wata727/tflint --format=checkstyle | reviewdog -f=checkstyle -reporter=github-pr-check -name=github-pr-check-info + + - name: Run ReviewDog (github-pr-check with fail-on-error) + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + docker run --rm --name tflint -v $PWD:/data -t wata727/tflint --format=checkstyle | reviewdog -f=checkstyle -name=pr-check-fail-on-error -reporter=github-pr-check -fail-on-error -filter-mode=nofilter + + checkov-check: + name: Checkov (github-check) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Run Checkov CLI test + continue-on-error: true + run: docker run --rm --name checkov -v $PWD:/tf bridgecrew/checkov -d /tf -o cli