-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ce7063
commit 00bd607
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
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
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 | ||