-
Notifications
You must be signed in to change notification settings - Fork 8
49 lines (42 loc) · 1.08 KB
/
terraform-checks.yml
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
49
name: "Terraform checks"
on:
pull_request:
paths-ignore:
- .gitignore
- "*.md"
- CODEOWNERS
branches:
- main
jobs:
terraform-checks:
name: "Terraform checks"
runs-on: ubuntu-latest
steps:
- name: Get pull request ref
id: sha
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { owner, repo, number } = context.issue;
const pr = await github.rest.pulls.get({
owner,
repo,
pull_number: number,
});
return pr.data.head.sha
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.sha.outputs.result }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Format
id: fmt
run: terraform fmt -check -diff
- name: Terraform Init
id: init
run: terraform init -backend=false
- name: Terraform Validate
id: validate
run: terraform validate -no-color