Skip to content

Commit e3bb028

Browse files
authored
Add tags (#3)
* update checks * add tags support * update checks * update checks
1 parent 9e0ce0b commit e3bb028

19 files changed

+445
-48
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @rhythmictech/engineering

.github/workflows/check.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/misspell.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: misspell
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
misspell:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: misspell
17+
uses: reviewdog/action-misspell@v1
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
locale: "US"
21+
reporter: github-check
22+
filter_mode: nofilter
23+
level: error

.github/workflows/pre-commit.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: pre-commit-check
3+
on:
4+
push:
5+
branches: -- main
6+
- master
7+
- prod
8+
- develop
9+
10+
jobs:
11+
pre-commit-check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
- name: Install prerequisites
18+
run: ./bin/install-ubuntu.sh
19+
- name: initialize Terraform
20+
run: terraform init --backend=false
21+
- name: pre-commit
22+
uses: pre-commit/action@v2.0.3
23+
env:
24+
AWS_DEFAULT_REGION: us-east-1
25+
# many of these are covered by better reviewdog linters below
26+
SKIP: >-
27+
terraform_tflint_deep,
28+
no-commit-to-branch,
29+
terraform_tflint_nocreds,
30+
terraform_tfsec

.github/workflows/pullRequest.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: pull request
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
# TODO: #22 add job using https://github.com/reviewdog/action-alex
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
- name: Install prerequisites
15+
run: ./bin/install-ubuntu.sh
16+
- name: initialize Terraform
17+
run: terraform init --backend=false
18+
- name: pre-commit
19+
uses: pre-commit/action@v2.0.3
20+
env:
21+
AWS_DEFAULT_REGION: us-east-1
22+
# many of these are covered by better reviewdog linters below
23+
SKIP: >-
24+
terraform_tflint_deep,
25+
no-commit-to-branch,
26+
terraform_tflint_nocreds,
27+
terraform_tfsec
28+
tflint:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v2
32+
- name: Install prerequisites
33+
run: ./bin/install-ubuntu.sh
34+
- name: Terraform init
35+
run: terraform init --backend=false
36+
- name: tflint
37+
uses: reviewdog/action-tflint@master
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
reporter: github-pr-check
41+
filter_mode: added
42+
flags: --module
43+
level: error
44+
tfsec:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- name: Install prerequisites
49+
run: ./bin/install-ubuntu.sh
50+
- name: Terraform init
51+
run: terraform init --backend=false
52+
- name: tfsec
53+
uses: reviewdog/action-tfsec@master
54+
with:
55+
github_token: ${{ secrets.GITHUB_TOKEN }}
56+
reporter: github-pr-check
57+
filter_mode: added
58+
level: warning
59+
misspell:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v2
63+
- name: misspell
64+
uses: reviewdog/action-misspell@v1
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
locale: "US"
68+
reporter: github-pr-check
69+
filter_mode: added
70+
level: error
71+
yamllint:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v2
75+
- name: yamllint
76+
uses: reviewdog/action-yamllint@v1
77+
with:
78+
github_token: ${{ secrets.GITHUB_TOKEN }}
79+
reporter: github-pr-check
80+
filter_mode: added
81+
level: error

.github/workflows/tflint.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: tflint
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
tflint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install prerequisites
17+
run: ./bin/install-ubuntu.sh
18+
- name: Terraform init
19+
run: terraform init --backend=false
20+
- name: tflint
21+
uses: reviewdog/action-tflint@master
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
reporter: github-check
25+
filter_mode: nofilter
26+
flags: --module
27+
level: error

.github/workflows/tfsec.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: tfsec
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
tfsec:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Install prerequisites
17+
run: ./bin/install-ubuntu.sh
18+
- name: Terraform init
19+
run: terraform init --backend=false
20+
- name: tfsec
21+
uses: reviewdog/action-tfsec@master
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
reporter: github-check
25+
filter_mode: nofilter
26+
level: error

.github/workflows/yamllint.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: yamllint
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- prod
9+
- develop
10+
11+
jobs:
12+
yamllint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: yamllint
17+
uses: reviewdog/action-yamllint@v1
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
reporter: github-check
21+
filter_mode: nofilter
22+
level: error

.pre-commit-config.yaml

Lines changed: 88 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,89 @@
1-
---
1+
exclude: ".terraform"
22
repos:
3-
- repo: git://github.com/antonbabenko/pre-commit-terraform
4-
rev: v1.24.0
5-
hooks:
6-
- id: terraform_fmt
7-
- id: terraform_docs
8-
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v2.4.0
10-
hooks:
11-
- id: end-of-file-fixer
12-
- id: trailing-whitespace
13-
- id: no-commit-to-branch
3+
- repo: https://github.com/antonbabenko/pre-commit-terraform
4+
rev: v1.50.0
5+
hooks:
6+
- id: terraform_docs
7+
always_run: true
8+
args:
9+
- --args=--sort-by-required
10+
- id: terraform_fmt
11+
- id: terraform_tflint
12+
alias: terraform_tflint_nocreds
13+
name: terraform_tflint_nocreds
14+
- id: terraform_tfsec
15+
- repo: local
16+
hooks:
17+
- id: terraform_validate
18+
name: terraform_validate
19+
entry: |
20+
bash -c '
21+
AWS_DEFAULT_REGION=us-east-1
22+
declare -a DIRS
23+
for FILE in "$@"
24+
do
25+
DIRS+=($(dirname "$FILE"))
26+
done
27+
for DIR in $(printf "%s\n" "${DIRS[@]}" | sort -u)
28+
do
29+
cd $(dirname "$FILE")
30+
terraform init --backend=false
31+
terraform validate .
32+
cd ..
33+
done
34+
'
35+
language: system
36+
verbose: true
37+
files: \.tf(vars)?$
38+
exclude: examples
39+
- id: tflock
40+
name: provider_locks
41+
entry: |
42+
bash -c '
43+
AWS_DEFAULT_REGION=us-east-1
44+
declare -a DIRS
45+
for FILE in "$@"
46+
do
47+
DIRS+=($(dirname "$FILE"))
48+
done
49+
for DIR in $(printf "%s\n" "${DIRS[@]}" | sort -u)
50+
do
51+
cd $(dirname "$FILE")
52+
terraform providers lock -platform=windows_amd64 -platform=darwin_amd64 -platform=linux_amd64
53+
cd ..
54+
done
55+
'
56+
language: system
57+
verbose: true
58+
files: \.tf(vars)?$
59+
exclude: examples
60+
- repo: https://github.com/pre-commit/pre-commit-hooks
61+
rev: v4.0.1
62+
hooks:
63+
- id: check-case-conflict
64+
- id: check-json
65+
- id: check-merge-conflict
66+
- id: check-symlinks
67+
- id: check-yaml
68+
args:
69+
- --unsafe
70+
- id: end-of-file-fixer
71+
- id: mixed-line-ending
72+
args:
73+
- --fix=lf
74+
- id: no-commit-to-branch
75+
args:
76+
- --branch
77+
- main
78+
- --branch
79+
- master
80+
- --branch
81+
- prod
82+
- id: pretty-format-json
83+
args:
84+
- --autofix
85+
- --top-keys=name,Name
86+
- id: trailing-whitespace
87+
args:
88+
- --markdown-linebreak-ext=md
89+
exclude: README.md

.terraform-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.23
1+
latest:^0.14

0 commit comments

Comments
 (0)