-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: run tofu fmt and validate using pre-commit (#12)
- Loading branch information
Showing
6 changed files
with
157 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,27 +6,6 @@ on: | |
pull_request: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: opentofu/setup-opentofu@v1 | ||
with: | ||
tofu_version: v1.7.2 # renovate: datasource=github-releases depName=opentofu/opentofu | ||
tofu_wrapper: false | ||
|
||
- run: | | ||
tofu init | ||
tofu validate | ||
tofu fmt | ||
- name: Check uncommitted changes | ||
run: git diff --exit-code | ||
|
||
- if: failure() | ||
run: echo "::error::Check failed, please run 'tofu validate; tofu fmt' and commit the changes." | ||
|
||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -37,8 +16,11 @@ jobs: | |
with: | ||
python-version: 3.x | ||
|
||
- name: Install dependencies | ||
run: pip install pre-commit | ||
- uses: opentofu/setup-opentofu@v1 | ||
with: | ||
tofu_version: v1.7.2 # renovate: datasource=github-releases depName=opentofu/opentofu | ||
tofu_wrapper: false | ||
|
||
- name: Run pre-commit | ||
run: pre-commit run --all-files --show-diff-on-failure | ||
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.terraform/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
SHELL = bash | ||
|
||
.terraform: | ||
tofu init -backend=false | ||
|
||
fmt: .terraform | ||
tofu fmt -recursive | ||
|
||
validate: .terraform | ||
tofu validate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters