Update Github Workflow #23
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
name: Run linting | |
on: | |
- push | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
name: Run linting | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Setup Tofu | |
uses: opentofu/setup-opentofu@v1 | |
- name: Setup TFLint | |
uses: terraform-linters/setup-tflint@v4 | |
- name: Cache terraform dir | |
uses: actions/cache@v4 | |
with: | |
path: ~/.terraform | |
key: terraform-${{ hashFiles('versions.tf') }} | |
- name: Cache tflint dir | |
uses: actions/cache@v4 | |
with: | |
path: ~/.tflint.d | |
key: tflint-${{ hashFiles('.tflint.hcl') }} | |
- name: Show version | |
run: | | |
tofu --version | |
tflint --version | |
- name: Run init | |
run: | | |
tflint --init | |
tofu init -upgrade | |
- name: Run linting | |
run: | | |
tofu fmt --recursive | |
tflint -f compact --module | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Run linting |