generated from storyprotocol/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.14 KB
/
terraform.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Terraform CI
on:
push:
branches:
- main
paths:
- '**.tf'
pull_request:
branches:
- main
paths:
- '**.tf'
jobs:
Timestamp:
uses: storyprotocol/gha-workflows/.github/workflows/reusable-timestamp.yml@main
terraform:
needs: [ Timestamp ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: "1.8.2"
- name: Terraform Format Check
run: terraform fmt -check
continue-on-error: true # This will mark the step as completed even if formatting errors are found
- name: Terraform Format
id: format
run: |
terraform fmt -recursive
echo "updated=$(git status --porcelain | grep '\.tf' | wc -l)" >> $GITHUB_ENV
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated Terraform format corrections
branch: ${{ github.head_ref }}
file_pattern: '*.tf'
if: env.updated == '1'