File tree Expand file tree Collapse file tree 2 files changed +44
-55
lines changed Expand file tree Collapse file tree 2 files changed +44
-55
lines changed Original file line number Diff line number Diff line change 1111 - ' quickstarts/**'
1212
1313jobs :
14+ terraform-fmt :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : checkout
18+ uses : actions/checkout@v3
19+ - name : terraform-fmt
20+ run : |
21+ if [ ! -f /usr/local/bin/terraform ]; then
22+ wget -q https://releases.hashicorp.com/terraform/1.6.0/terraform_1.6.0_linux_amd64.zip
23+ unzip terraform_1.6.0_linux_amd64.zip -d /usr/local/bin/
24+ fi
25+ error=false
26+ echo "===> Terraform fmt -diff checking in quickstarts"
27+ (terraform -chdir=quickstarts fmt -check -recursive -list=false) || error=true
28+ terraform -chdir=quickstarts fmt -diff -recursive
29+ if ${error}; then
30+ echo -e "\033[31m[ERROR]\033[0m: Some quickstarts codes has not been formatted, and please running terraform fmt --recursive command before pushing."
31+ exit 1
32+ fi
33+
34+ terraform-validate :
35+ runs-on : ubuntu-latest
36+ steps :
37+ - name : checkout
38+ uses : actions/checkout@v3
39+ - name : Get changed files
40+ id : changed-files
41+ uses : tj-actions/changed-files@v34
42+ with :
43+ dir_names : " true"
44+ separator : " ,"
45+ files : " quickstarts/*"
46+ dir_names_max_depth : 2
47+ - name : pr-check
48+ run : |
49+ bash scripts/terraform-install.sh
50+ CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}"
51+ if [ -z "${{ github.event.number }}" ]; then
52+ CHANGED_FOLDERS=$(find ./quickstarts -maxdepth 1 -mindepth 1 -type d | tr '\n' ',')
53+ fi
54+ bash scripts/terraform-validate.sh ${CHANGED_FOLDERS}
55+
56+
1457 e2e-check :
58+ needs : [terraform-fmt, terraform-validate]
1559 runs-on : ubuntu-latest
1660 name : ' e2e check'
1761 steps :
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments