Skip to content

Commit

Permalink
Adding pre-commit for #27
Browse files Browse the repository at this point in the history
  • Loading branch information
commjoen committed Oct 7, 2022
1 parent 684bf9f commit ff0a6e1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
custom: https://owasp.org/donate/?reponame=www-project-wrongsecrets&title=OWASP+wrongsecrets
custom: ["https://owasp.org/donate/?reponame=www-project-wrongsecrets&title=OWASP+wrongsecrets", "https://www.icrc.org/en/donate/ukraine"]
github: OWASP
51 changes: 51 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Pre-commit check

# Controls when the workflow will run
on:
pull_request:
branches: [master]
workflow_dispatch:

env:
TF_DOCS_VERSION: v0.16.0
TFSEC_VERSION: v1.27.6
TFLINT_VERSION: v0.41.0
permissions:
contents: read
jobs:
pre-commit:
name: Pre-commit check
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- uses: actions/cache@v3
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.1.7
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v2
with:
tflint_version: ${{env.TFLINT_VERSION}}
- name: Setup Terraform docs
run: |
wget https://github.com/terraform-docs/terraform-docs/releases/download/${{env.TF_DOCS_VERSION}}/terraform-docs-${{env.TF_DOCS_VERSION}}-linux-amd64.tar.gz -O terraform_docs.tar.gz
tar -zxvf terraform_docs.tar.gz terraform-docs
chmod +x terraform-docs
mv terraform-docs /usr/local/bin/
- name: Setup tfsec
run: |
curl --output tfsec https://github.com/aquasecurity/tfsec/releases/download/${{env.TFSEC_VERSION}}/tfsec-linux-amd64
chmod +x tfsec
mv tfsec /usr/local/bin/
- name: Pre-commit checks
uses: pre-commit/[email protected]

0 comments on commit ff0a6e1

Please sign in to comment.