Skip to content

Commit

Permalink
pre-commit (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
gareda authored Jan 21, 2024
1 parent aedc585 commit fa3a0df
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "pre-commit"

on:
pull_request:
branches:
- main

permissions:
id-token: write
contents: read

jobs:
main:
runs-on: ubuntu-latest

steps:
- name: Download repository
uses: actions/checkout@v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.3.0"

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Install dependencies
run: brew install tflint terraform-docs

- uses: pre-commit/[email protected]
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.86.0
hooks:
- id: terraform_fmt
name: Format Terraform code

- id: terraform_validate
name: Validate Terraform code
exclude: ^(examples|tests)
args:
- --tf-init-args=-upgrade
- --tf-init-args=-backend=false
- --hook-config=--retry-once-with-cleanup=true

- id: terraform_tflint
name: Validate Terraform tests
exclude: ^(examples|tests)
args:
- --args=--enable-rule=terraform_naming_convention
- --args=--enable-rule=terraform_unused_required_providers
- --args=--module

- id: terraform_docs
name: Generate Terraform documentation

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.38.0
hooks:
- id: markdownlint
name: Validate Markdown text

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
name: Check for files that contain merge conflict strings

- id: end-of-file-fixer
name: Makes sure files end in a newline and only a newline

0 comments on commit fa3a0df

Please sign in to comment.