Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

ci: Update GitHub actions #85

ci: Update GitHub actions

ci: Update GitHub actions #85

Workflow file for this run

name: Pre-Commit
on:
pull_request:
branches:
- main
env:
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/.terraform.d/plugin-cache
jobs:
pre-commit:
name: Pre-commit validation
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Setup Python environment
uses: actions/setup-python@v3
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v4
- name: Setup Terraform Cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-terraform-${{ hashFiles('.terraform.lock.hcl') }}
path: ${{ env.TF_PLUGIN_CACHE_DIR }}
- name: Setup Go environment
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: "Install pre-commit tools: terraform-docs & tfsec"
run: |
mkdir -p $TF_PLUGIN_CACHE_DIR
go install github.com/terraform-docs/terraform-docs@latest
sudo mv $(go env GOPATH)/bin/terraform-docs /usr/local/bin/terraform-docs
go install github.com/aquasecurity/tfsec/cmd/tfsec@latest
sudo mv $(go env GOPATH)/bin/tfsec /usr/local/bin/tfsec
go install golang.org/x/tools/cmd/goimports@latest
sudo mv $(go env GOPATH)/bin/goimports /usr/local/bin/goimports
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.0
terraform_wrapper: false
- name: Run pre-commit hooks
uses: pre-commit/[email protected]