Skip to content

Commit

Permalink
add tf formatting workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
agnesgaroux committed Oct 24, 2024
1 parent 3ce7063 commit 00bd607
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/tf_formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Runs auto-formatting script on push to any branch
name: "Run terraform formatting"

permissions:
id-token: write
contents: write

on: push

jobs:
autoformat:
name: autoformat
runs-on: ubuntu-latest
steps:
- name: Check out project
uses: actions/checkout@v4

- name: terraform fmt
uses: dflook/terraform-fmt@v1

- name: Check for formatting changes
id: check_formatting_changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> "$GITHUB_OUTPUT";
fi
- name: Commit and push formatting changes
if: steps.check_formatting_changes.outputs.changes == 'true'
run: |
git config user.name "Github on behalf of Wellcome Collection"
git config user.email "wellcomedigitalplatform@wellcome.ac.uk"
git commit -am "Apply auto-formatting rules"
git push

0 comments on commit 00bd607

Please sign in to comment.