-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (36 loc) · 1.35 KB
/
pre-commit.yml
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
name: pre-commit
on:
workflow_dispatch:
pull_request:
branches:
- main
- master
env:
TERRAFORM_DOCS_VERSION: "v0.16.0"
TFLINT_VERSION: "v0.36.2"
jobs:
pre-commit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install additional pre-commit hooks
shell: bash
run: |
echo "########### Install Checkov ####################"
pip install checkov
echo "########### Install Terraform-docs #############"
wget https://github.com/terraform-docs/terraform-docs/releases/download/${{ env.TERRAFORM_DOCS_VERSION }}/terraform-docs-${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz
tar xvzf terraform-docs-${{ env.TERRAFORM_DOCS_VERSION }}-linux-amd64.tar.gz
mkdir -p ~/terraform-docs/bin/
install terraform-docs ~/terraform-docs/bin/
echo '~/terraform-docs/bin/' >> $GITHUB_PATH
echo "########### Install Terraform-linters ##########"
wget https://github.com/terraform-linters/tflint/releases/download/${{ env.TFLINT_VERSION }}/tflint_linux_amd64.zip
unzip tflint_linux_amd64.zip
mkdir -p ~/tflint/bin/
echo '~/tflint/bin/' >> $GITHUB_PATH
install tflint ~/tflint/bin/
~/tflint/bin/tflint --init
- name: Run pre-commit
uses: pre-commit/[email protected]