Skip to content

Commit fd4bfa3

Browse files
authored
Merge pull request #6 from HENNGE/update-gha
Update gha
2 parents a618422 + 1780f0d commit fd4bfa3

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

.github/workflows/lint.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
name: lint
22

3-
on: [push, pull_request]
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
48

59
jobs:
610
build:
711

812
runs-on: ubuntu-latest
913

1014
steps:
11-
- uses: actions/checkout@v1
12-
- name: Run pre-commit test
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: 3.x
19+
- name: Install pre-commit dependency - terraform-docs
1320
run: |
14-
sudo apt-get install python3-pip gawk
15-
curl https://pre-commit.com/install-local.py | python3 -
16-
# Terraform Docs
17-
curl -Lo ./terraform-docs https://github.com/terraform-docs/terraform-docs/releases/download/v0.9.1/terraform-docs-v0.9.1-$(uname | tr '[:upper:]' '[:lower:]')-amd64
18-
chmod +x ./terraform-docs
19-
sudo mv ./terraform-docs /usr/bin/terraform-docs
20-
# Tflint
21-
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
22-
# Run pre-commit
23-
/home/runner/bin/pre-commit --version
24-
terraform-docs --version
25-
/home/runner/bin/pre-commit run -a
21+
TF_DOCS_VER="v0.9.1"
22+
pushd /tmp
23+
curl -Lo ./terraform-docs https://github.com/terraform-docs/terraform-docs/releases/download/${TF_DOCS_VER}/terraform-docs-${TF_DOCS_VER}-$(uname | tr '[:upper:]' '[:lower:]')-amd64 && chmod +x ./terraform-docs && sudo mv ./terraform-docs /usr/bin/
24+
popd
25+
- name: Install pre-commit dependency - tflint
26+
uses: terraform-linters/setup-tflint@v2
27+
with:
28+
tflint_version: v0.34.0
29+
- name: Run pre-commit test
30+
uses: pre-commit/action@v3.0.0
31+
with:
32+
extra_args: --all-files

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repos:
2-
- repo: git://github.com/antonbabenko/pre-commit-terraform
2+
- repo: https://github.com/antonbabenko/pre-commit-terraform
33
rev: v1.43.0
44
hooks:
55
- id: terraform_fmt

0 commit comments

Comments
 (0)