Skip to content

Commit

Permalink
Adding FMT on push (#1979)
Browse files Browse the repository at this point in the history
* fmt on push

* Update workflows versions
  • Loading branch information
arnaudlh authored May 23, 2024
1 parent 17638b6 commit 8dd2e2d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/on_push_fmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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 "[email protected]"
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/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8dd2e2d

Please sign in to comment.