From 32dae61a0aab10f7df3df7eba2d2d21a4a0ce234 Mon Sep 17 00:00:00 2001 From: David Arnold <10138997+djaboxx@users.noreply.github.com> Date: Fri, 21 Mar 2025 22:24:29 -0700 Subject: [PATCH] Update terraform-test.yml --- .github/workflows/terraform-test.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/terraform-test.yml b/.github/workflows/terraform-test.yml index 1055bf3..dd482a9 100644 --- a/.github/workflows/terraform-test.yml +++ b/.github/workflows/terraform-test.yml @@ -33,10 +33,23 @@ jobs: terraform_version: "~>1.6.0" terraform_wrapper: false - - name: Terraform Format + - name: Format Terraform files + run: terraform fmt -recursive id: fmt - run: terraform fmt -check - continue-on-error: false + + - name: Check for file changes + id: check_changes + run: | + git diff --exit-code || echo "changes_detected=true" >> $GITHUB_ENV + + - name: Commit and push changes + if: env.changes_detected == 'true' + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "chore: format terraform files" + git push origin HEAD:${{ github.event.pull_request.head.ref }} - name: Terraform Init id: init