Skip to content

Commit eab8af4

Browse files
committed
chore: update pre-commit hooks and CI workflows
1 parent eb7164b commit eab8af4

File tree

8 files changed

+95
-85
lines changed

8 files changed

+95
-85
lines changed

.github/workflows/pre-commit.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- master
8+
9+
env:
10+
TERRAFORM_DOCS_VERSION: v0.16.0
11+
12+
jobs:
13+
collectInputs:
14+
name: Collect workflow inputs
15+
runs-on: ubuntu-latest
16+
outputs:
17+
directories: ${{ steps.dirs.outputs.directories }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Get root directories
23+
id: dirs
24+
uses: clowdhaus/terraform-composite-actions/[email protected]
25+
26+
preCommitMinVersions:
27+
name: Min TF pre-commit
28+
needs: collectInputs
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
37+
- name: Terraform min/max versions
38+
id: minMax
39+
uses: clowdhaus/[email protected]
40+
with:
41+
directory: ${{ matrix.directory }}
42+
43+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
44+
# Run only validate pre-commit check on min version supported
45+
if: ${{ matrix.directory != '.' }}
46+
uses: clowdhaus/terraform-composite-actions/[email protected]
47+
with:
48+
terraform-version: ${{ steps.minMax.outputs.minVersion }}
49+
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
50+
51+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
52+
# Run only validate pre-commit check on min version supported
53+
if: ${{ matrix.directory == '.' }}
54+
uses: clowdhaus/terraform-composite-actions/[email protected]
55+
with:
56+
terraform-version: ${{ steps.minMax.outputs.minVersion }}
57+
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'
58+
59+
preCommitMaxVersion:
60+
name: Max TF pre-commit
61+
runs-on: ubuntu-latest
62+
needs: collectInputs
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v2
66+
with:
67+
ref: ${{ github.event.pull_request.head.ref }}
68+
repository: ${{github.event.pull_request.head.repo.full_name}}
69+
70+
- name: Terraform min/max versions
71+
id: minMax
72+
uses: clowdhaus/[email protected]
73+
74+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
75+
uses: clowdhaus/terraform-composite-actions/[email protected]
76+
with:
77+
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
78+
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}

.github/workflows/semantic-releaser.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: release
22

33
on:
44
push:
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
release:
14-
name: Release
14+
name: release
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
@@ -27,5 +27,5 @@ jobs:
2727

2828
- name: Release
2929
env:
30-
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
30+
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE }}
3131
run: npx semantic-release

.github/workflows/static-checks.yml

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

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ terraform.rc
3939
# Lambda zip archive and scripts
4040
*.zip
4141
!/modules/**/vendored_archives/*.zip
42-
*.py
42+
*.py

.pre-commit-config.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
repos:
2-
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.52.0
2+
- repo: https://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.55.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs
7-
- repo: git://github.com/pre-commit/pre-commit-hooks
7+
args:
8+
- '--args=--lockfile=false'
9+
- id: terraform_validate
10+
- id: terraform_tflint
11+
- repo: https://github.com/pre-commit/pre-commit-hooks
812
rev: v4.0.1
913
hooks:
1014
- id: check-merge-conflict
15+
- id: end-of-file-fixer

examples/complete/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Note that this example may create resources which will incur monetary charges on
3030

3131
| Name | Version |
3232
|------|---------|
33-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.59.0 |
34-
| <a name="provider_random"></a> [random](#provider\_random) | 3.1.0 |
33+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.0 |
34+
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
3535

3636
## Modules
3737

examples/complete/pattern.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(\d{3}-\d{2}-\d{4})|((\d{3}\) |\d{3}-)\d{3}-\d{4})|(\d{3}-\d{4})
1+
(\d{3}-\d{2}-\d{4})|((\d{3}\) |\d{3}-)\d{3}-\d{4})|(\d{3}-\d{4})

examples/simple/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Note that this example may create resources which will incur monetary charges on
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.59.0 |
30-
| <a name="provider_random"></a> [random](#provider\_random) | 3.1.0 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.0 |
30+
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
3131

3232
## Modules
3333

0 commit comments

Comments
 (0)