-
Notifications
You must be signed in to change notification settings - Fork 7
60 lines (47 loc) · 1.54 KB
/
code-format-validation.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
50
51
52
53
54
55
56
57
58
59
60
name: Lint Checker
on:
pull_request:
jobs:
lint-checker:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Python Version Check
run: python --version
- name: Install Yamllint
run: pip install yamllint
- name: Yamllint Version Check
run: yamllint --version
- uses: terraform-linters/setup-tflint@v4
name: Setup TFLint
- name: Show version
run: tflint --version
- name: Init TFLint
run: tflint --init
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Terraform Lint Check
run: tflint --recursive --config "$GITHUB_WORKSPACE/.tflint.hcl" --minimum-failure-severity=warning
- name: Yamllint Check
run: yamllint -c $GITHUB_WORKSPACE/.yamllint . --no-warnings
- name: Scenario name check
if: always()
run: |
set -eu
SCENARIO_NAME_MAX_LENGTH=30
check_failed=false
scenario_names=$(find $GITHUB_WORKSPACE/scenarios/ -name "*.tfvars" | awk -F'/' '{print $9}' | sort -u)
for name in $scenario_names; do
if [ ${#name} -gt $SCENARIO_NAME_MAX_LENGTH ]; then
echo "::error::Scenario folder name $name is greater than $SCENARIO_NAME_MAX_LENGTH characters. Please rename the folder to a shorter name."
check_failed=true
fi
done
if [ "$check_failed" = true ]; then
exit 1
fi