-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (37 loc) · 1.29 KB
/
pr-workflow.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
name: PR Workflow
on:
pull_request:
branches:
- 'main'
jobs:
terraform:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "eu-west-1"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Run Terraform fmt
run: terraform fmt --recursive --check
id: terraform_fmt
continue-on-error: true
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v4
- name: Run TFLint
run: tflint --recursive
id: terraform_lint
continue-on-error: true
- name: Generate summary of linting
run: |
terraform_fmt_status="❌"
terraform_lint_status="❌"
[ ${{ steps.terraform_fmt.outcome }} == 'success' ] && terraform_fmt_status="✅"
[ ${{ steps.terraform_lint.outcome }} == 'success' ] && terraform_lint_status="✅"
echo "Terraform Linting" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Terraform Formating ${terraform_fmt_status}" >> $GITHUB_STEP_SUMMARY
echo "- Terraform Linting ${terraform_lint_status}" >> $GITHUB_STEP_SUMMARY