Merge pull request #2040 from aztfmod/dependabot/terraform/hashicorp/… #22
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: Terraform Format | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
terraform: | |
name: 'Terraform Format' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Important: This is needed to push changes back to the repository | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Terraform Format | |
run: terraform fmt -recursive | |
- name: Commit changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git diff --quiet && git diff --staged --quiet || (git add -A && git commit -m "Apply terraform fmt") | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |