Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/pre-commit-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Pre-commit Check

on:
pull_request:
branches: [ main ]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get changed files
uses: tj-actions/changed-files@v41
id: changed-files

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: latest

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit on changed files
run: |
pre-commit run --files ${{ steps.changed-files.outputs.all_changed_files }} --hook-stage push
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: local
hooks:
- id: terraform_clean
name: "Terraform Cleanup"
pass_filenames: false
language: system
entry: bash -c "find . \( -iname ".terraform*" ! -iname ".terraform-docs*" ! -path "*/test/*" \) -print0 | xargs -0 rm -r; true"
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.4
hooks:
- id: terraform_fmt
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: no-commit-to-branch
args: [--branch, main, --pattern, ".*/.*"]
Loading